Completed
Pull Request — develop (#48)
by Hugo
04:02
created

ServiceTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 1
cbo 2
dl 0
loc 45
rs 10
1
<?php
2
namespace PHPSC\PagSeguro;
3
4
use PHPSC\PagSeguro\Client\Client;
5
6
/**
7
 * @author Luís Otávio Cobucci Oblonczyk <[email protected]>
8
 */
9
class ServiceTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @var Credentials
13
     */
14
    protected $credentials;
15
16
    /**
17
     * @var Client|\PHPUnit_Framework_MockObject_MockObject
18
     */
19
    protected $client;
20
21
    protected function setUp()
22
    {
23
        $this->credentials = new Credentials('[email protected]', 't');
24
        $this->client = $this->createMock(Client::class);
25
    }
26
27
    /**
28
     * @test
29
     */
30
    public function constructorShouldConfigureAttributes()
31
    {
32
        $service = $this->getMockForAbstractClass(
33
            Service::class,
34
            [$this->credentials, $this->client]
35
        );
36
37
        $this->assertAttributeSame($this->credentials, 'credentials', $service);
38
        $this->assertAttributeSame($this->client, 'client', $service);
39
    }
40
41
    /**
42
     * @test
43
     */
44
    public function constructorShouldCreateAClientWhenItWasntInformed()
45
    {
46
        $service = $this->getMockForAbstractClass(
47
            Service::class,
48
            [$this->credentials]
49
        );
50
51
        $this->assertAttributeInstanceOf(Client::class, 'client', $service);
52
    }
53
}
54