| Total Complexity | 5 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 76.47% |
| Changes | 3 | ||
| Bugs | 0 | Features | 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 | new \Promopult\Dadata\Credentials('token', 'secret'), |
|
| 16 | 4 | new \GuzzleHttp\Client() |
|
| 17 | 4 | ); |
|
| 18 | } |
||
| 19 | 4 | ||
| 20 | /** |
||
| 21 | * @param string $name |
||
| 22 | * |
||
| 23 | * @dataProvider validServiceNamesDataProvider |
||
| 24 | */ |
||
| 25 | public function testCreatesService($name) |
||
| 26 | 3 | { |
|
| 27 | $service = $this->client->getService($name); |
||
| 28 | 3 | ||
| 29 | $this->assertInstanceOf(\Promopult\Dadata\Service::class, $service); |
||
| 30 | 3 | } |
|
| 31 | 3 | ||
| 32 | /** |
||
| 33 | * @param string $name |
||
| 34 | * |
||
| 35 | * @dataProvider invalidServiceNamesDataProvider |
||
| 36 | */ |
||
| 37 | public function testThrowsServiceNotFoundExceptionOnInvalidServiceName($name) |
||
| 38 | 1 | { |
|
| 39 | $this->expectException(\Promopult\Dadata\Exceptions\ServiceNotFoundException::class); |
||
| 40 | 1 | ||
| 41 | $this->client->getService($name); |
||
| 42 | 1 | } |
|
| 43 | |||
| 44 | public function validServiceNamesDataProvider() |
||
| 45 | { |
||
| 46 | return [ |
||
| 47 | ['clean'], |
||
| 48 | ['suggestions'], |
||
| 49 | ['profile'] |
||
| 50 | ]; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function invalidServiceNamesDataProvider() |
||
| 57 | ]; |
||
| 58 | } |
||
| 59 | } |
||
| 60 |