Code Duplication    Length = 14-17 lines in 3 locations

Test/Unit/Model/Methods/BaseMethodTest.php 1 location

@@ 190-206 (lines=17) @@
187
        $this->classToTest->refund($paymentInfo, 100);
188
    }
189
190
    public function testCapture()
191
    {
192
        $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
193
194
        $paymentInfo = $this->getMockBuilder(Info::class)
195
            ->disableOriginalConstructor()
196
            ->setMethods(['getOrder', 'getParentTransactionId'])
197
            ->getMock();
198
        $paymentInfo->method('getOrder')->willReturn($order);
199
        $paymentInfo->method('getParentTransactionId')->willReturn(true);
200
201
        $aResponse = ['status' => 'APPROVED'];
202
        $this->captureRequest->method('sendRequest')->willReturn($aResponse);
203
204
        $result = $this->classToTest->capture($paymentInfo, 100);
205
        $this->assertInstanceOf(Paydirekt::class, $result);
206
    }
207
208
    public function testCaptureError()
209
    {

Test/Unit/Model/Plugins/MethodListTest.php 2 locations

@@ 121-134 (lines=14) @@
118
        $this->assertInstanceOf(MethodInterface::class, $result[0]);
119
    }
120
121
    public function testAfterGetAvailableMethods()
122
    {
123
        $this->consumerscore->method('sendRequest')->willReturn(['score' => 'Y']);
124
        $this->consumerscoreHelper->method('getWorstScore')->willReturn('R');
125
126
        $subject = $this->getMockBuilder(MethodList::class)->disableOriginalConstructor()->getMock();
127
128
        $payment = $this->getMockBuilder(MethodInterface::class)->disableOriginalConstructor()->getMock();
129
        $payment->method('getCode')->willReturn(PayoneConfig::METHOD_CASH_ON_DELIVERY);
130
        $paymentMethods = [$payment];
131
132
        $result = $this->classToTest->afterGetAvailableMethods($subject, $paymentMethods);
133
        $this->assertInstanceOf(MethodInterface::class, $result[0]);
134
    }
135
136
    public function testAfterGetAvailableMethodsEmpty()
137
    {
@@ 136-149 (lines=14) @@
133
        $this->assertInstanceOf(MethodInterface::class, $result[0]);
134
    }
135
136
    public function testAfterGetAvailableMethodsEmpty()
137
    {
138
        $this->consumerscore->method('sendRequest')->willReturn(['score' => 'Y']);
139
        $this->consumerscoreHelper->method('getWorstScore')->willReturn('R');
140
141
        $subject = $this->getMockBuilder(MethodList::class)->disableOriginalConstructor()->getMock();
142
143
        $payment = $this->getMockBuilder(MethodInterface::class)->disableOriginalConstructor()->getMock();
144
        $payment->method('getCode')->willReturn(PayoneConfig::METHOD_BARZAHLEN);
145
        $paymentMethods = [$payment];
146
147
        $result = $this->classToTest->afterGetAvailableMethods($subject, $paymentMethods);
148
        $this->assertEmpty($result);
149
    }
150
}
151