| @@ 96-110 (lines=15) @@ | ||
| 93 | ]); |
|
| 94 | } |
|
| 95 | ||
| 96 | public function testShowMandateLink() |
|
| 97 | { |
|
| 98 | $this->paymentHelper->method('isMandateManagementDownloadActive')->willReturn(true); |
|
| 99 | ||
| 100 | $order = $this->getMockBuilder(Order::class) |
|
| 101 | ->disableOriginalConstructor() |
|
| 102 | ->setMethods(['getPayoneMandateId']) |
|
| 103 | ->getMock(); |
|
| 104 | $order->method('getPayoneMandateId')->willReturn('15'); |
|
| 105 | ||
| 106 | $this->checkoutSession->method('getLastRealOrder')->willReturn($order); |
|
| 107 | ||
| 108 | $result = $this->classToTest->showMandateLink(); |
|
| 109 | $this->assertTrue($result); |
|
| 110 | } |
|
| 111 | ||
| 112 | public function testShowMandateLinkFalse() |
|
| 113 | { |
|
| @@ 145-154 (lines=10) @@ | ||
| 142 | $this->assertNull($result); |
|
| 143 | } |
|
| 144 | ||
| 145 | public function testExecuteSuccess() |
|
| 146 | { |
|
| 147 | $paymentMethod = $this->getMockBuilder(PayoneMethod::class)->disableOriginalConstructor()->getMock(); |
|
| 148 | $this->payment->method('getMethodInstance')->willReturn($paymentMethod); |
|
| 149 | $this->request->method('getParam')->willReturn(0); |
|
| 150 | $this->checkoutSession->method('getPayoneMandate')->willReturn(['dummyMandate']); |
|
| 151 | ||
| 152 | $result = $this->classToTest->execute(); |
|
| 153 | $this->assertNull($result); |
|
| 154 | } |
|
| 155 | ||
| 156 | public function testExecuteMandateMismatch() |
|
| 157 | { |
|
| @@ 156-166 (lines=11) @@ | ||
| 153 | $this->assertNull($result); |
|
| 154 | } |
|
| 155 | ||
| 156 | public function testExecuteMandateMismatch() |
|
| 157 | { |
|
| 158 | $paymentMethod = $this->getMockBuilder(PayoneMethod::class)->disableOriginalConstructor()->getMock(); |
|
| 159 | $paymentMethod->method('getCustomConfigParam')->willReturn(true); |
|
| 160 | $this->payment->method('getMethodInstance')->willReturn($paymentMethod); |
|
| 161 | $this->request->method('getParam')->willReturn(1); |
|
| 162 | $this->checkoutSession->method('getPayoneMandate')->willReturn(['mandate_identification' => 5]); |
|
| 163 | ||
| 164 | $result = $this->classToTest->execute(); |
|
| 165 | $this->assertNull($result); |
|
| 166 | } |
|
| 167 | ||
| 168 | public function testExecuteMandate() |
|
| 169 | { |
|
| @@ 99-110 (lines=12) @@ | ||
| 96 | ]); |
|
| 97 | } |
|
| 98 | ||
| 99 | public function testGetConfig() |
|
| 100 | { |
|
| 101 | $method = $this->getMockBuilder(AbstractMethod::class) |
|
| 102 | ->disableOriginalConstructor() |
|
| 103 | ->setMethods(['getInstructions']) |
|
| 104 | ->getMock(); |
|
| 105 | $method->method('getInstructions')->willReturn('Instruction'); |
|
| 106 | $this->dataHelper->method('getMethodInstance')->willReturn($method); |
|
| 107 | ||
| 108 | $result = $this->classToTest->getConfig(); |
|
| 109 | $this->assertNotEmpty($result); |
|
| 110 | } |
|
| 111 | ||
| 112 | public function testGetConfigNoInstance() |
|
| 113 | { |
|