Skip to content

Commit 563f84d

Browse files
committed
test: add test for consequtive call of Client::getApi()
1 parent 0f9c3a8 commit 563f84d

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/Unit/Client/NativeCurlClientTest.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ public function testCurlErrorThrowsException(): void
966966
* @dataProvider getApiClassesProvider
967967
*/
968968
#[DataProvider('getApiClassesProvider')]
969-
public function testGetApiShouldReturnApiInstance(string $apiName, string $class): void
969+
public function testGetApiReturnsApiInstance(string $apiName, string $class): void
970970
{
971971
$client = new NativeCurlClient(
972972
'http://test.local',
@@ -1001,7 +1001,24 @@ public static function getApiClassesProvider(): array
10011001
];
10021002
}
10031003

1004-
public function testGetApiShouldThrowException(): void
1004+
/**
1005+
* @dataProvider getApiClassesProvider
1006+
*/
1007+
#[DataProvider('getApiClassesProvider')]
1008+
public function testGetApiOnMultipleCallsReturnSameApiInstance(string $apiName, string $class): void
1009+
{
1010+
$client = new NativeCurlClient(
1011+
'http://test.local',
1012+
'access_token',
1013+
);
1014+
1015+
$this->assertSame(
1016+
$client->getApi($apiName),
1017+
$client->getApi($apiName)
1018+
);
1019+
}
1020+
1021+
public function testGetApiWithInvalidApiThrowsException(): void
10051022
{
10061023
$client = new NativeCurlClient(
10071024
'http://test.local',

0 commit comments

Comments
 (0)