| @@ 116-129 (lines=14) @@ | ||
| 113 | $this->assertInstanceOf(MethodInterface::class, $result[0]); |
|
| 114 | } |
|
| 115 | ||
| 116 | public function testAfterGetAvailableMethods() |
|
| 117 | { |
|
| 118 | $this->consumerscore->method('sendRequest')->willReturn(['score' => 'Y']); |
|
| 119 | $this->consumerscoreHelper->method('getWorstScore')->willReturn('R'); |
|
| 120 | ||
| 121 | $subject = $this->getMockBuilder(MethodList::class)->disableOriginalConstructor()->getMock(); |
|
| 122 | ||
| 123 | $payment = $this->getMockBuilder(MethodInterface::class)->disableOriginalConstructor()->getMock(); |
|
| 124 | $payment->method('getCode')->willReturn(PayoneConfig::METHOD_CASH_ON_DELIVERY); |
|
| 125 | $paymentMethods = [$payment]; |
|
| 126 | ||
| 127 | $result = $this->classToTest->afterGetAvailableMethods($subject, $paymentMethods); |
|
| 128 | $this->assertInstanceOf(MethodInterface::class, $result[0]); |
|
| 129 | } |
|
| 130 | ||
| 131 | public function testAfterGetAvailableMethodsEmpty() |
|
| 132 | { |
|
| @@ 131-144 (lines=14) @@ | ||
| 128 | $this->assertInstanceOf(MethodInterface::class, $result[0]); |
|
| 129 | } |
|
| 130 | ||
| 131 | public function testAfterGetAvailableMethodsEmpty() |
|
| 132 | { |
|
| 133 | $this->consumerscore->method('sendRequest')->willReturn(['score' => 'Y']); |
|
| 134 | $this->consumerscoreHelper->method('getWorstScore')->willReturn('R'); |
|
| 135 | ||
| 136 | $subject = $this->getMockBuilder(MethodList::class)->disableOriginalConstructor()->getMock(); |
|
| 137 | ||
| 138 | $payment = $this->getMockBuilder(MethodInterface::class)->disableOriginalConstructor()->getMock(); |
|
| 139 | $payment->method('getCode')->willReturn(PayoneConfig::METHOD_BARZAHLEN); |
|
| 140 | $paymentMethods = [$payment]; |
|
| 141 | ||
| 142 | $result = $this->classToTest->afterGetAvailableMethods($subject, $paymentMethods); |
|
| 143 | $this->assertEmpty($result); |
|
| 144 | } |
|
| 145 | } |
|
| 146 | ||
| @@ 188-204 (lines=17) @@ | ||
| 185 | $this->classToTest->refund($paymentInfo, 100); |
|
| 186 | } |
|
| 187 | ||
| 188 | public function testCapture() |
|
| 189 | { |
|
| 190 | $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); |
|
| 191 | ||
| 192 | $paymentInfo = $this->getMockBuilder(Info::class) |
|
| 193 | ->disableOriginalConstructor() |
|
| 194 | ->setMethods(['getOrder', 'getParentTransactionId']) |
|
| 195 | ->getMock(); |
|
| 196 | $paymentInfo->method('getOrder')->willReturn($order); |
|
| 197 | $paymentInfo->method('getParentTransactionId')->willReturn(true); |
|
| 198 | ||
| 199 | $aResponse = ['status' => 'APPROVED']; |
|
| 200 | $this->captureRequest->method('sendRequest')->willReturn($aResponse); |
|
| 201 | ||
| 202 | $result = $this->classToTest->capture($paymentInfo, 100); |
|
| 203 | $this->assertInstanceOf(Paydirekt::class, $result); |
|
| 204 | } |
|
| 205 | ||
| 206 | public function testCaptureError() |
|
| 207 | { |
|