Code Duplication    Length = 10-15 lines in 4 locations

tests/Resource/PaymentTest.php 4 locations

@@ 40-49 (lines=10) @@
37
        $this->assertNotEmpty($payment->getFundingInstrument()->boleto);
38
    }
39
40
    public function testCreditCardPCIStore()
41
    {
42
        $this->mockHttpSession($this->body_order);
43
        $order = $this->createOrder()->create();
44
        $cc = '5555666677778884';
45
        $this->mockHttpSession($this->body_cc_pay_pci_store);
46
        $payment = $order->payments()->setCreditCard(5, 2018, $cc, 123, $this->createHolder(), false)->execute();
47
        $this->assertFalse($payment->getFundingInstrument()->creditCard->store);
48
        $this->assertNotEmpty($payment->getId());
49
    }
50
51
    public function testShouldCreateEscrowPaymentWithCreditCard()
52
    {
@@ 51-62 (lines=12) @@
48
        $this->assertNotEmpty($payment->getId());
49
    }
50
51
    public function testShouldCreateEscrowPaymentWithCreditCard()
52
    {
53
        $this->mockHttpSession($this->body_order);
54
        $order = $this->createOrder()->create();
55
        $cc = '5555666677778884';
56
        $this->mockHttpSession($this->body_cc_pay_pci_escrow);
57
        $payment = $order->payments()
58
            ->setCreditCard(5, 2018, $cc, 123, $this->createHolder(), false)
59
            ->setEscrow('teste de descricao')
60
            ->execute();
61
        $this->assertEquals('teste de descricao', $payment->getEscrow()->description);
62
    }
63
64
    /**
65
     * MoipTest creating a credit card multipayment, passing all credit card data.
@@ 93-107 (lines=15) @@
90
        $this->assertNotEmpty($payment->getFundingInstrument()->boleto);
91
    }
92
93
    public function testCapturePreAuthorizedPayment()
94
    {
95
        $this->mockHttpSession($this->body_order);
96
        $order = $this->createOrder()->create();
97
        $this->mockHttpSession($this->body_cc_delay_capture);
98
        $payment = $order->payments()
99
            ->setCreditCard(5, 2018, '5555666677778884', 123, $this->createHolder(), false)
100
            ->setDelayCapture(true)
101
            ->execute();
102
103
        $this->mockHttpSession($this->body_capture_pay);
104
        $captured_payment = $payment->capture();
105
106
        $this->assertEquals('AUTHORIZED', $captured_payment->getStatus());
107
    }
108
109
    public function testCapturePreAuthorizedMultiPayment()
110
    {
@@ 141-155 (lines=15) @@
138
        $this->assertEquals('CANCELLED', $cancelled_payment->getStatus());
139
    }
140
141
    public function testCancelPreAuthorizedPayment()
142
    {
143
        $this->mockHttpSession($this->body_order);
144
        $order = $this->createOrder()->create();
145
        $this->mockHttpSession($this->body_cc_delay_capture);
146
        $payment = $order->payments()
147
            ->setCreditCard(5, 2018, '5555666677778884', 123, $this->createHolder(), false)
148
            ->setDelayCapture(true)
149
            ->execute();
150
151
        $this->mockHttpSession($this->body_cancel_pay);
152
        $cancelled_payment = $payment->cancel();
153
154
        $this->assertEquals('CANCELLED', $cancelled_payment->getStatus());
155
    }
156
157
    public function testGetPayment()
158
    {