| @@ 130-142 (lines=13) @@ | ||
| 127 | $this->assertTrue($result); |
|
| 128 | } |
|
| 129 | ||
| 130 | public function testAuthorize() |
|
| 131 | { |
|
| 132 | $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); |
|
| 133 | ||
| 134 | $paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock(); |
|
| 135 | $paymentInfo->method('getOrder')->willReturn($order); |
|
| 136 | ||
| 137 | $aResponse = ['status' => 'REDIRECT', 'txid' => '12345', 'redirecturl' => 'http://testdomain.com']; |
|
| 138 | $this->authorizationRequest->method('sendRequest')->willReturn($aResponse); |
|
| 139 | ||
| 140 | $result = $this->classToTest->authorize($paymentInfo, 100); |
|
| 141 | $this->assertInstanceOf(Paydirekt::class, $result); |
|
| 142 | } |
|
| 143 | ||
| 144 | public function testAuthorizeError() |
|
| 145 | { |
|
| @@ 144-156 (lines=13) @@ | ||
| 141 | $this->assertInstanceOf(Paydirekt::class, $result); |
|
| 142 | } |
|
| 143 | ||
| 144 | public function testAuthorizeError() |
|
| 145 | { |
|
| 146 | $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); |
|
| 147 | ||
| 148 | $paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock(); |
|
| 149 | $paymentInfo->method('getOrder')->willReturn($order); |
|
| 150 | ||
| 151 | $aResponse = ['status' => 'ERROR', 'errorcode' => '42', 'customermessage' => 'Test error']; |
|
| 152 | $this->authorizationRequest->method('sendRequest')->willReturn($aResponse); |
|
| 153 | ||
| 154 | $this->expectException(LocalizedException::class); |
|
| 155 | $this->classToTest->authorize($paymentInfo, 100); |
|
| 156 | } |
|
| 157 | ||
| 158 | public function testRefund() |
|
| 159 | { |
|
| @@ 95-107 (lines=13) @@ | ||
| 92 | $this->assertEquals($expected, $result); |
|
| 93 | } |
|
| 94 | ||
| 95 | public function testAuthorize() |
|
| 96 | { |
|
| 97 | $response = ['status' => 'OK', 'workorderid' => 'WORKORDER']; |
|
| 98 | $this->precheckRequest->method('sendRequest')->willReturn($response); |
|
| 99 | ||
| 100 | $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); |
|
| 101 | ||
| 102 | $payment = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock(); |
|
| 103 | $payment->method('getOrder')->willReturn($order); |
|
| 104 | ||
| 105 | $result = $this->classToTest->authorize($payment, 100); |
|
| 106 | $this->assertInstanceOf(ClassToTest::class, $result); |
|
| 107 | } |
|
| 108 | ||
| 109 | public function testAssignData() |
|
| 110 | { |
|
| @@ 96-108 (lines=13) @@ | ||
| 93 | $this->assertEquals($expected, $result); |
|
| 94 | } |
|
| 95 | ||
| 96 | public function testAuthorize() |
|
| 97 | { |
|
| 98 | $response = ['status' => 'OK', 'workorderid' => 'WORKORDER']; |
|
| 99 | $this->precheckRequest->method('sendRequest')->willReturn($response); |
|
| 100 | ||
| 101 | $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); |
|
| 102 | ||
| 103 | $payment = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock(); |
|
| 104 | $payment->method('getOrder')->willReturn($order); |
|
| 105 | ||
| 106 | $result = $this->classToTest->authorize($payment, 100); |
|
| 107 | $this->assertInstanceOf(ClassToTest::class, $result); |
|
| 108 | } |
|
| 109 | ||
| 110 | public function testAuthorizeException() |
|
| 111 | { |
|
| @@ 110-122 (lines=13) @@ | ||
| 107 | $this->assertInstanceOf(ClassToTest::class, $result); |
|
| 108 | } |
|
| 109 | ||
| 110 | public function testAuthorizeException() |
|
| 111 | { |
|
| 112 | $response = ['status' => 'ERROR', 'errorcode' => '123', 'customermessage' => 'error']; |
|
| 113 | $this->precheckRequest->method('sendRequest')->willReturn($response); |
|
| 114 | ||
| 115 | $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); |
|
| 116 | ||
| 117 | $payment = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock(); |
|
| 118 | $payment->method('getOrder')->willReturn($order); |
|
| 119 | ||
| 120 | $this->expectException(LocalizedException::class); |
|
| 121 | $this->classToTest->authorize($payment, 100); |
|
| 122 | } |
|
| 123 | ||
| 124 | public function testGetLongSubType() |
|
| 125 | { |
|