/** * @param bool $expectedResult * @param \Magento\Framework\DataObject $response * @param string $avsSecurityCodeFlag * * @dataProvider validationDataProvider */ public function testValidation($expectedResult, \Magento\Framework\DataObject $response, $avsSecurityCodeFlag) { $this->configMock->expects($this->once())->method('getValue')->with(CVV2Match::CONFIG_NAME)->willReturn($avsSecurityCodeFlag); $this->assertEquals($expectedResult, $this->validator->validate($response)); if (!$expectedResult) { $this->assertNotEmpty($response->getRespmsg()); } }
/** * @param bool $expectedResult * @param \Magento\Framework\Object $response * @param array $configMap * @param int $exactlyCount * * @dataProvider validationDataProvider */ public function testValidation($expectedResult, \Magento\Framework\Object $response, array $configMap, $exactlyCount) { $this->configMock->expects($this->exactly($exactlyCount))->method('getValue')->willReturnMap($configMap); $this->assertEquals($expectedResult, $this->validator->validate($response)); if (!$expectedResult) { $this->assertNotEmpty($response->getRespmsg()); } }
/** * @param bool $expectedResult * @param \Magento\Framework\DataObject $response * @param array $configMap * @param int $exactlyCount * * @dataProvider validationDataProvider */ public function testValidation($expectedResult, \Magento\Framework\DataObject $response, array $configMap, $exactlyCount) { $this->payflowproFacade->expects(static::once())->method('getConfig')->willReturn($this->configMock); $this->configMock->expects(static::exactly($exactlyCount))->method('getValue')->willReturnMap($configMap); static::assertEquals($expectedResult, $this->validator->validate($response, $this->payflowproFacade)); if (!$expectedResult) { static::assertNotEmpty($response->getRespmsg()); } }
/** * test for _buildBasicRequest (BDCODE) */ public function testFetchTransactionInfoForBN() { $response = $this->getGatewayResponseObject(); $this->gatewayMock->expects($this->once())->method('postRequest')->willReturn($response); $this->initStoreMock(); $this->configMock->expects($this->once())->method('getBuildNotationCode')->will($this->returnValue('BNCODE')); $payment = $this->getMock('Magento\\Payment\\Model\\Info', ['setTransactionId', '__wakeup'], [], '', false); $payment->expects($this->once())->method('setTransactionId')->will($this->returnSelf()); $this->payflowpro->fetchTransactionInfo($payment, 'AD49G8N825'); }
/** * test for _buildBasicRequest (BDCODE) */ public function testFetchTransactionInfoForBN() { $storeMock = $this->getMock('Magento\\Store\\Model\\Store', ['getId'], [], '', false); $response = new \Magento\Framework\Object(['result' => '0', 'pnref' => 'V19A3D27B61E', 'respmsg' => 'Approved', 'authcode' => '510PNI', 'hostcode' => 'A', 'request_id' => 'f930d3dc6824c1f7230c5529dc37ae5e', 'result_code' => '0']); $this->gatewayMock->expects($this->once())->method('postRequest')->willReturn($response); $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); $storeMock->expects($this->once())->method('getId')->willReturn(77); $this->configMock->expects($this->once())->method('getBuildNotationCode')->will($this->returnValue('BNCODE')); $payment = $this->getMock('Magento\\Payment\\Model\\Info', ['setTransactionId', '__wakeup'], [], '', false); $payment->expects($this->once())->method('setTransactionId')->will($this->returnSelf()); $this->payflowpro->fetchTransactionInfo($payment, 'AD49G8N825'); }