-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClientTest.php
82 lines (63 loc) · 2.67 KB
/
ClientTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
// Copyright (C) 2021 Ivan Stasiuk <brokeyourbike@gmail.com>.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.
namespace BrokeYourBike\ZenithBank\Tests;
use PHPUnit\Framework\TestCase;
use BrokeYourBike\ZenithBank\Interfaces\ConfigInterface;
use BrokeYourBike\ZenithBank\Client;
use BrokeYourBike\ResolveUri\ResolveUriTrait;
use BrokeYourBike\HttpClient\HttpClientTrait;
use BrokeYourBike\HttpClient\HttpClientInterface;
use BrokeYourBike\HasSourceModel\HasSourceModelTrait;
use BrokeYourBike\HasSourceModel\HasSourceModelInterface;
/**
* @author Ivan Stasiuk <brokeyourbike@gmail.com>
*/
class ClientTest extends TestCase
{
/** @test */
public function it_implements_http_client_interface(): void
{
/** @var ConfigInterface */
$mockedConfig = $this->getMockBuilder(ConfigInterface::class)->getMock();
/** @var \GuzzleHttp\ClientInterface */
$mockedHttpClient = $this->getMockBuilder(\GuzzleHttp\ClientInterface::class)->getMock();
/** @var \Psr\SimpleCache\CacheInterface */
$mockedCache = $this->getMockBuilder(\Psr\SimpleCache\CacheInterface::class)->getMock();
$api = new Client($mockedConfig, $mockedHttpClient, $mockedCache);
$this->assertInstanceOf(HttpClientInterface::class, $api);
}
/** @test */
public function it_implements_has_source_model_interface(): void
{
/** @var ConfigInterface */
$mockedConfig = $this->getMockBuilder(ConfigInterface::class)->getMock();
/** @var \GuzzleHttp\ClientInterface */
$mockedHttpClient = $this->getMockBuilder(\GuzzleHttp\ClientInterface::class)->getMock();
/** @var \Psr\SimpleCache\CacheInterface */
$mockedCache = $this->getMockBuilder(\Psr\SimpleCache\CacheInterface::class)->getMock();
$api = new Client($mockedConfig, $mockedHttpClient, $mockedCache);
$this->assertInstanceOf(HasSourceModelInterface::class, $api);
}
/** @test */
public function it_uses_http_client_trait(): void
{
$usedTraits = class_uses(Client::class);
$this->assertArrayHasKey(HttpClientTrait::class, $usedTraits);
}
/** @test */
public function it_uses_resolve_uri_trait(): void
{
$usedTraits = class_uses(Client::class);
$this->assertArrayHasKey(ResolveUriTrait::class, $usedTraits);
}
/** @test */
public function it_uses_has_source_model_trait(): void
{
$usedTraits = class_uses(Client::class);
$this->assertArrayHasKey(HasSourceModelTrait::class, $usedTraits);
}
}