|
@@ 128-140 (lines=13) @@
|
| 125 |
|
$this->assertTrue($result); |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
public function testAuthorize() |
| 129 |
|
{ |
| 130 |
|
$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); |
| 131 |
|
|
| 132 |
|
$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock(); |
| 133 |
|
$paymentInfo->method('getOrder')->willReturn($order); |
| 134 |
|
|
| 135 |
|
$aResponse = ['status' => 'REDIRECT', 'txid' => '12345', 'redirecturl' => 'http://testdomain.com']; |
| 136 |
|
$this->authorizationRequest->method('sendRequest')->willReturn($aResponse); |
| 137 |
|
|
| 138 |
|
$result = $this->classToTest->authorize($paymentInfo, 100); |
| 139 |
|
$this->assertInstanceOf(Paydirekt::class, $result); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
public function testAuthorizeError() |
| 143 |
|
{ |
|
@@ 142-154 (lines=13) @@
|
| 139 |
|
$this->assertInstanceOf(Paydirekt::class, $result); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
public function testAuthorizeError() |
| 143 |
|
{ |
| 144 |
|
$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); |
| 145 |
|
|
| 146 |
|
$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock(); |
| 147 |
|
$paymentInfo->method('getOrder')->willReturn($order); |
| 148 |
|
|
| 149 |
|
$aResponse = ['status' => 'ERROR', 'errorcode' => '42', 'customermessage' => 'Test error']; |
| 150 |
|
$this->authorizationRequest->method('sendRequest')->willReturn($aResponse); |
| 151 |
|
|
| 152 |
|
$this->setExpectedException(LocalizedException::class); |
| 153 |
|
$this->classToTest->authorize($paymentInfo, 100); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
public function testRefund() |
| 157 |
|
{ |