Exemple #1
0
 public function testGetResponseStatusOther()
 {
     $result = $this->getResultMock();
     $response = (object) ['status' => (object) ['statusCode' => 'OTHER']];
     $result->expects($this->once())->method('getResponse')->willReturn($response);
     $this->setExpectedException(Exception::class, \Zend_Json::encode($response->status));
     Util::callMethod($this->model, 'getResponse', [$result]);
 }
 public function testSpecificInformation()
 {
     $transport = new \Magento\Framework\DataObject();
     Util::setProperty($this->block, '_paymentSpecificInformation', $transport);
     $status = 'status';
     $statusDescription = 'desc';
     $orderId = 1;
     $info = $this->getMockBuilder(\Magento\Payment\Model\Info::class)->setMethods(['getParentId'])->disableOriginalConstructor()->getMock();
     $info->expects($this->once())->method('getParentId')->willReturn($orderId);
     $this->transactionResource->expects($this->once())->method('getLastStatusByOrderId')->with($this->equalTo($orderId))->willReturn($status);
     $this->block->setData('info', $info);
     $client = $this->getClientMock();
     $clientOrderHelper = $this->getMockBuilder(\Orba\Payupl\Model\Client\OrderInterface::class)->disableOriginalConstructor()->getMock();
     $clientOrderHelper->expects($this->once())->method('getStatusDescription')->with($this->equalTo($status))->willReturn($statusDescription);
     $client->expects($this->once())->method('getOrderHelper')->willReturn($clientOrderHelper);
     $transport->setData((string) __('Status'), $statusDescription);
     $this->assertSame($transport, Util::callMethod($this->block, '_prepareSpecificInformation'));
 }