Passed
Pull Request — develop (#53)
by Luís
03:03
created

DetailsTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 97
rs 10
1
<?php
2
namespace PHPSC\PagSeguro\Purchases;
3
4
use DateTime;
5
use PHPSC\PagSeguro\Customer\Customer;
6
7
/**
8
 * @author Adelar Tiemann Junior <[email protected]>
9
 */
10
class DetailsTest extends \PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @var Details
14
     */
15
    private $details;
16
17
    /**
18
     * @var DateTime
19
     */
20
    private $date;
21
22
    /**
23
     * @var DateTime
24
     */
25
    private $lastEventDate;
26
27
    /**
28
     * @var Customer
29
     */
30
    private $customer;
31
32
    protected function setUp()
33
    {
34
        $this->date = new DateTime("2015-01-01");
35
        $this->lastEventDate = new DateTime("2015-01-01");
36
        $this->customer = $this->createMock(Customer::class);
37
        $this->details = new Details(
38
            '1',
39
            'SomeRef',
40
            2,
41
            $this->date,
42
            $this->lastEventDate,
43
            $this->customer
44
        );
45
    }
46
47
    /**
48
     * @test
49
     */
50
    public function constructShouldConfigureTheAttributes()
51
    {
52
        $this->assertAttributeEquals('1', 'code', $this->details);
53
        $this->assertAttributeEquals('SomeRef', 'reference', $this->details);
54
        $this->assertAttributeEquals(2, 'status', $this->details);
55
        $this->assertAttributeSame($this->date, 'date', $this->details);
56
        $this->assertAttributeSame($this->lastEventDate, 'lastEventDate', $this->details);
57
        $this->assertAttributeSame($this->customer, 'customer', $this->details);
58
    }
59
60
    /**
61
     * @test
62
     * @depends constructShouldConfigureTheAttributes
63
     */
64
    public function getCodeShouldReturnTheConfiguredCode()
65
    {
66
        $this->assertEquals("1", $this->details->getCode());
67
    }
68
69
    /**
70
     * @test
71
     * @depends constructShouldConfigureTheAttributes
72
     */
73
    public function getReferenceShouldReturnTheConfiguredReference()
74
    {
75
        $this->assertEquals("SomeRef", $this->details->getReference());
76
    }
77
78
    /**
79
     * @test
80
     * @depends constructShouldConfigureTheAttributes
81
     */
82
    public function getStatusShouldReturnTheConfiguredStatus()
83
    {
84
        $this->assertEquals(2, $this->details->getStatus());
85
    }
86
87
    /**
88
     * @test
89
     * @depends constructShouldConfigureTheAttributes
90
     */
91
    public function getDateShouldReturnTheConfiredDate()
92
    {
93
        $this->assertSame($this->date, $this->details->getDate());
94
    }
95
96
    /**
97
     * @test
98
     * @depends constructShouldConfigureTheAttributes
99
     */
100
    public function getLastEventDateShouldReturnTheConfiredLastEventDate()
101
    {
102
        $this->assertSame($this->lastEventDate, $this->details->getLastEventDate());
103
    }
104
105
    /**
106
     * @test
107
     * @depends constructShouldConfigureTheAttributes
108
     */
109
    public function getCustomerShouldReturnTheConfiredCustomer()
110
    {
111
        $this->assertSame($this->customer, $this->details->getCustomer());
112
    }
113
}
114