Skip to content

Commit

Permalink
Merge driver discovery and async client factory test
Browse files Browse the repository at this point in the history
  • Loading branch information
jenky committed Sep 28, 2023
1 parent ab346b5 commit 4e96d83
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/PoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,35 @@ public function test_concurrency_limit(): void
$pool->concurrent(-1);
}

public function test_driver_discovery(): void
public function test_async_client_factory(): void
{
$this->assertSame(Driver::AMP, DriverDiscovery::find(false));
$client = AsyncClientFactory::create(new Client());
$this->assertInstanceOf(GuzzleClient::class, $client);
$this->assertSame(Driver::AMP, $client->driver());

$client = AsyncClientFactory::create(new Psr18Client());
$this->assertInstanceOf(SymfonyClient::class, $client);
$this->assertSame(Driver::AMP, $client->driver());

DriverDiscovery::prefer(Driver::PSL);

$this->assertSame(Driver::PSL, DriverDiscovery::find(false));
$client = AsyncClientFactory::create(new Client());
$this->assertInstanceOf(GuzzleClient::class, $client);
$this->assertSame(Driver::PSL, $client->driver());

DriverDiscovery::prefer(Driver::REACT);
$client = AsyncClientFactory::create(new Psr18Client());
$this->assertInstanceOf(SymfonyClient::class, $client);
$this->assertSame(Driver::PSL, $client->driver());

$this->assertSame(Driver::REACT, DriverDiscovery::find(false));
}
DriverDiscovery::prefer(Driver::REACT);

public function test_async_client_factory(): void
{
$client = AsyncClientFactory::create(new Client());
$this->assertInstanceOf(GuzzleClient::class, $client);
$this->assertSame(Driver::REACT, $client->driver());

$client = AsyncClientFactory::create(new Psr18Client());
$this->assertInstanceOf(SymfonyClient::class, $client);
$this->assertSame(Driver::REACT, $client->driver());
}

public function test_invalid_client_pool_request(): void
Expand Down

0 comments on commit 4e96d83

Please sign in to comment.