Passed
Push — develop ( 19a8b8...726e4d )
by Luís
29s
created

RedirectionTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 55
rs 10
1
<?php
2
namespace PHPSC\PagSeguro\Requests;
3
4
use DateTime;
5
6
class RedirectionTest extends \PHPUnit_Framework_TestCase
7
{
8
    /**
9
     * @var Redirection
10
     */
11
    private $redirection;
12
13
    /**
14
     * @var DateTime
15
     */
16
    private $date;
17
18
    protected function setUp()
19
    {
20
        $this->date = new DateTime('2014-05-30');
21
        $this->redirection = new Redirection(1, $this->date, 'http://example.org');
22
    }
23
24
    /**
25
     * @test
26
     */
27
    public function constructShouldConfigureTheAttributes()
28
    {
29
        $this->assertAttributeEquals(1, 'code', $this->redirection);
30
        $this->assertAttributeSame($this->date, 'date', $this->redirection);
31
        $this->assertAttributeEquals('http://example.org', 'uri', $this->redirection);
32
    }
33
34
    /**
35
     * @test
36
     * @depends constructShouldConfigureTheAttributes
37
     */
38
    public function getCodeShouldReturnTheConfiguredCode()
39
    {
40
        $this->assertEquals(1, $this->redirection->getCode());
41
    }
42
43
    /**
44
     * @test
45
     * @depends constructShouldConfigureTheAttributes
46
     */
47
    public function getDateShouldReturnTheConfiredDate()
48
    {
49
        $this->assertSame($this->date, $this->redirection->getDate());
50
    }
51
52
    /**
53
     * @test
54
     * @depends constructShouldConfigureTheAttributes
55
     */
56
    public function getRedirectionUrlShouldReturnTheUriWithCodeAsQueryString()
57
    {
58
        $this->assertSame('http://example.org?code=1', $this->redirection->getRedirectionUrl());
59
    }
60
}
61