Code Duplication    Length = 23-23 lines in 2 locations

Test/Unit/Model/Api/Request/Genericpayment/PayPalExpressTest.php 2 locations

@@ 68-90 (lines=23) @@
65
        ]);
66
    }
67
68
    public function testSendRequest()
69
    {
70
        $quote = $this->getMockBuilder(Quote::class)
71
            ->disableOriginalConstructor()
72
            ->setMethods(['getGrandTotal', 'getQuoteCurrencyCode'])
73
            ->getMock();
74
        $quote->method('getGrandTotal')->willReturn(123);
75
        $quote->method('getQuoteCurrencyCode')->willReturn('EUR');
76
77
        $payment = $this->getMockBuilder(Paypal::class)->disableOriginalConstructor()->getMock();
78
        $payment->method('getOperationMode')->willReturn('test');
79
        $payment->method('getSuccessUrl')->willReturn('http://testdomain.com');
80
        $payment->method('getErrorUrl')->willReturn('http://testdomain.com');
81
        $payment->method('getCancelUrl')->willReturn('http://testdomain.com');
82
83
        $this->shopHelper->method('getConfigParam')->willReturn('12345');
84
85
        $response = ['status' => 'APPROVED'];
86
        $this->apiHelper->method('sendApiRequest')->willReturn($response);
87
88
        $result = $this->classToTest->sendRequest($quote, $payment, 100);
89
        $this->assertEquals($response, $result);
90
    }
91
92
    public function testSendRequestNoWorkorderId()
93
    {
@@ 92-114 (lines=23) @@
89
        $this->assertEquals($response, $result);
90
    }
91
92
    public function testSendRequestNoWorkorderId()
93
    {
94
        $quote = $this->getMockBuilder(Quote::class)
95
            ->disableOriginalConstructor()
96
            ->setMethods(['getGrandTotal', 'getQuoteCurrencyCode'])
97
            ->getMock();
98
        $quote->method('getGrandTotal')->willReturn(123);
99
        $quote->method('getQuoteCurrencyCode')->willReturn('EUR');
100
101
        $payment = $this->getMockBuilder(Paypal::class)->disableOriginalConstructor()->getMock();
102
        $payment->method('getOperationMode')->willReturn('test');
103
        $payment->method('getSuccessUrl')->willReturn('http://testdomain.com');
104
        $payment->method('getErrorUrl')->willReturn('http://testdomain.com');
105
        $payment->method('getCancelUrl')->willReturn('http://testdomain.com');
106
107
        $this->shopHelper->method('getConfigParam')->willReturn('12345');
108
109
        $response = ['status' => 'APPROVED'];
110
        $this->apiHelper->method('sendApiRequest')->willReturn($response);
111
112
        $result = $this->classToTest->sendRequest($quote, $payment);
113
        $this->assertEquals($response, $result);
114
    }
115
}
116