1 | <?php |
||
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 |