Completed
Pull Request — master (#42)
by
unknown
02:42
created

PaymentTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 1 Features 1
Metric Value
wmc 1
c 4
b 1
f 1
lcom 1
cbo 2
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCreditCardPCI() 0 13 1
1
<?php
2
3
namespace Moip\Tests\Resource;
4
5
use Moip\Tests\MoipTestCase;
6
7
class PaymentTest extends MoipTestCase
8
{
9
    //todo: test boleto and credit card hash
10
11
    /**
12
     * Test creating a credit card payment, passing all credit card data.
13
     */
14
    public function testCreditCardPCI()
15
    {
16
        $this->mockHttpSession($this->body_order);
17
        $order = $this->createOrder()->create();
18
        $this->mockHttpSession($this->body_cc_pay_pci);
19
        $cc = '5555666677778884';
20
        $payment = $order->payments()->setCreditCard(5, 2018, $cc, 123, $this->createCustomer())->execute();
21
        $this->assertNotEmpty($payment->getFundingInstrument()->creditCard);
22
        $first6 = $payment->getFundingInstrument()->creditCard->first6;
23
        $last4 = $payment->getFundingInstrument()->creditCard->last4;
24
        $this->assertEquals($first6, substr($cc, 0, 6));
25
        $this->assertEquals($last4, substr($cc, -4));
26
    }
27
}
28