| Total Complexity | 5 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 72.21% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class ClientTest extends TestCase |
||
| 9 | { |
||
| 10 | private $client; |
||
| 11 | |||
| 12 | 4 | public function setUp(): void |
|
| 13 | { |
||
| 14 | 4 | $this->client = new Client( |
|
| 15 | 4 | 'token', |
|
| 16 | 4 | 'secret', |
|
| 17 | 4 | new \Http\Adapter\Guzzle6\Client() |
|
| 18 | ); |
||
| 19 | 4 | } |
|
| 20 | |||
| 21 | /** |
||
| 22 | * @param string $name |
||
| 23 | * |
||
| 24 | * @dataProvider validServiceNamesDataProvider |
||
| 25 | */ |
||
| 26 | 3 | public function testCreatesService($name) |
|
| 27 | { |
||
| 28 | 3 | $service = $this->client->getService($name); |
|
| 29 | |||
| 30 | 3 | $this->assertInstanceOf(\Promopult\Dadata\Service::class, $service); |
|
| 31 | 3 | } |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @param string $name |
||
| 35 | * |
||
| 36 | * @dataProvider invalidServiceNamesDataProvider |
||
| 37 | */ |
||
| 38 | 1 | public function testThrowsServiceNotFoundExceptionOnInvalidServiceName($name) |
|
| 39 | { |
||
| 40 | 1 | $this->expectException(\Promopult\Dadata\Exceptions\ServiceNotFoundException::class); |
|
| 41 | |||
| 42 | 1 | $this->client->getService($name); |
|
| 43 | } |
||
| 44 | |||
| 45 | public function validServiceNamesDataProvider() |
||
| 46 | { |
||
| 47 | return [ |
||
| 48 | ['clean'], |
||
| 49 | ['suggestions'], |
||
| 50 | ['profile'] |
||
| 51 | ]; |
||
| 52 | } |
||
| 53 | |||
| 54 | public function invalidServiceNamesDataProvider() |
||
| 58 | ]; |
||
| 59 | } |
||
| 60 | } |
||
| 61 |