/** * @expectedException \Magento\Framework\Model\Exception */ public function testInitialize() { $order = $this->getMock('Magento\\Sales\\Model\\Order', [], [], '', false); $this->infoInstance->expects($this->any())->method('getOrder')->will($this->returnValue($order)); $this->paypalConfig->expects($this->once())->method('getBuildNotationCode')->will($this->returnValue('build notation code')); $this->payflowRequest->expects($this->once())->method('setData')->with('BNCODE', 'build notation code')->will($this->returnSelf()); $this->model->initialize(\Magento\Paypal\Model\Config::PAYMENT_ACTION_AUTH, new \Magento\Framework\Object()); }
public function testInitialize() { $order = $this->getMock('Magento\\Sales\\Model\\Order', [], [], '', false); $this->infoInstance->expects($this->any())->method('getOrder')->will($this->returnValue($order)); $this->infoInstance->expects($this->any())->method('setAdditionalInformation')->will($this->returnSelf()); $this->paypalConfig->expects($this->once())->method('getBuildNotationCode')->will($this->returnValue('build notation code')); $response = new \Magento\Framework\DataObject(['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->payflowRequest->expects($this->exactly(3))->method('setData')->willReturnMap([['user' => null, 'vendor' => null, 'partner' => null, 'pwd' => null, 'verbosity' => null, 'BNCODE' => 'build notation code', 'tender' => 'C'], $this->returnSelf()], ['USER1', 1, $this->returnSelf()], ['USER2', 'a20d3dc6824c1f7780c5529dc37ae5e', $this->returnSelf()]); $stateObject = new \Magento\Framework\DataObject(); $this->model->initialize(\Magento\Paypal\Model\Config::PAYMENT_ACTION_AUTH, $stateObject); }