Code Duplication    Length = 13-13 lines in 5 locations

Test/Unit/Model/Methods/BaseMethodTest.php 2 locations

@@ 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
    {

Test/Unit/Model/Methods/Payolution/DebitTest.php 1 location

@@ 93-105 (lines=13) @@
90
        $this->assertEquals($expected, $result);
91
    }
92
93
    public function testAuthorize()
94
    {
95
        $response = ['status' => 'OK', 'workorderid' => 'WORKORDER'];
96
        $this->precheckRequest->method('sendRequest')->willReturn($response);
97
98
        $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
99
100
        $payment = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
101
        $payment->method('getOrder')->willReturn($order);
102
103
        $result = $this->classToTest->authorize($payment, 100);
104
        $this->assertInstanceOf(ClassToTest::class, $result);
105
    }
106
107
    public function testAssignData()
108
    {

Test/Unit/Model/Methods/Payolution/InvoiceTest.php 2 locations

@@ 94-106 (lines=13) @@
91
        $this->assertEquals($expected, $result);
92
    }
93
94
    public function testAuthorize()
95
    {
96
        $response = ['status' => 'OK', 'workorderid' => 'WORKORDER'];
97
        $this->precheckRequest->method('sendRequest')->willReturn($response);
98
99
        $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
100
101
        $payment = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
102
        $payment->method('getOrder')->willReturn($order);
103
104
        $result = $this->classToTest->authorize($payment, 100);
105
        $this->assertInstanceOf(ClassToTest::class, $result);
106
    }
107
108
    public function testAuthorizeException()
109
    {
@@ 108-120 (lines=13) @@
105
        $this->assertInstanceOf(ClassToTest::class, $result);
106
    }
107
108
    public function testAuthorizeException()
109
    {
110
        $response = ['status' => 'ERROR', 'errorcode' => '123', 'customermessage' => 'error'];
111
        $this->precheckRequest->method('sendRequest')->willReturn($response);
112
113
        $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
114
115
        $payment = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
116
        $payment->method('getOrder')->willReturn($order);
117
118
        $this->setExpectedException(LocalizedException::class);
119
        $this->classToTest->authorize($payment, 100);
120
    }
121
122
    public function testGetLongSubType()
123
    {