41 $this->store = $this->createMock(\
Magento\
Store\Model\Store::class);
45 $this->paypalConfig = $this->getMockBuilder(\
Magento\Paypal\Model\Config::class)
46 ->disableOriginalConstructor()
49 $configFactoryMock = $this->getMockBuilder(\
Magento\
Payment\Model\Method\ConfigInterfaceFactory::class)
50 ->setMethods([
'create'])
51 ->disableOriginalConstructor()
54 $requestFactory = $this->getMockBuilder(\
Magento\Paypal\Model\Payflow\RequestFactory::class)
55 ->setMethods([
'create'])
56 ->disableOriginalConstructor()
59 $this->payflowRequest = $this->getMockBuilder(\
Magento\Paypal\Model\Payflow\Request::class)
60 ->disableOriginalConstructor()
63 $this->infoInstance = $this->getMockBuilder(\
Magento\Sales\Model\
Order\Payment::class)
64 ->disableOriginalConstructor()
67 $this->scopeConfigMock = $this->getMockBuilder(\
Magento\Framework\
App\
Config\ScopeConfigInterface::class)
68 ->getMockForAbstractClass();
70 $this->gatewayMock = $this->getMockBuilder(\
Magento\Paypal\Model\Payflow\Service\Gateway::class)
71 ->disableOriginalConstructor()
74 $storeManager->expects($this->any())->method(
'getStore')->will($this->returnValue($this->store));
75 $configFactoryMock->expects($this->any())
77 ->willReturn($this->paypalConfig);
78 $this->payflowRequest->expects($this->any())
80 ->will($this->returnCallback(
function (
$method) {
81 if (strpos(
$method,
'set') === 0) {
86 $requestFactory->expects($this->any())->method(
'create')->will($this->returnValue($this->payflowRequest));
88 $helper =
new ObjectManagerHelper($this);
89 $this->model =
$helper->getObject(
90 \
Magento\Paypal\Model\Payflowlink::class,
92 'scopeConfig' => $this->scopeConfigMock,
94 'configFactory' => $configFactoryMock,
95 'requestFactory' => $requestFactory,
96 'gateway' => $this->gatewayMock,
99 $this->model->setInfoInstance($this->infoInstance);
105 $order = $this->createMock(\
Magento\Sales\Model\Order::class);
106 $order->expects($this->exactly(2))
107 ->method(
'getStoreId')
109 $this->infoInstance->expects($this->any())
112 $this->infoInstance->expects($this->any())
113 ->method(
'setAdditionalInformation')
115 $this->paypalConfig->expects($this->once())
116 ->method(
'getBuildNotationCode')
117 ->willReturn(
'build notation code');
119 $response = new \Magento\Framework\DataObject(
122 'pnref' =>
'V19A3D27B61E',
123 'respmsg' =>
'Approved',
124 'authcode' =>
'510PNI',
126 'request_id' =>
'f930d3dc6824c1f7230c5529dc37ae5e',
127 'result_code' =>
'0',
130 $this->gatewayMock->expects($this->once())
131 ->method(
'postRequest')
134 $this->payflowRequest->expects($this->exactly(3))
144 'BUTTONSOURCE' =>
'build notation code',
149 [
'USER1', 1, $this->returnSelf()],
150 [
'USER2',
'a20d3dc6824c1f7780c5529dc37ae5e', $this->returnSelf()]
153 $stateObject = new \Magento\Framework\DataObject();
155 self::assertEquals(
$storeId, $this->model->getStore(),
'{Store} should be set');
166 $this->scopeConfigMock->expects($this->once())
169 "payment/payflow_link/active",
172 )->willReturn($configResult);
174 $this->assertEquals($expectedResult, $this->model->isActive(
$storeId));
193 static::assertEquals(Info::class, $this->model->getInfoBlockType());
testIsActive($expectedResult, $configResult)
dataProviderForTestIsActive()
const PAYMENT_ACTION_AUTH