Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jenky committed Sep 22, 2023
1 parent 0fa5181 commit 26c1c19
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Concurrency/DriverDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class DriverDiscovery
private static ?Driver $preferred = null;

/**
* Find the appropriate async driver based on the installed package.
* Find the appropriate async driver based on the installed packages.
*
* @throws \RuntimeException
*/
Expand Down
19 changes: 19 additions & 0 deletions tests/PoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Fansipan\Concurrent\Concurrency\Driver;
use Fansipan\Concurrent\Concurrency\DriverDiscovery;
use Fansipan\Concurrent\ConnectorPool;
use Fansipan\Concurrent\Exception\InvalidPoolRequestException;
use Fansipan\Concurrent\Exception\UnsupportedClientException;
use Fansipan\Concurrent\Pool;
use Fansipan\Concurrent\PoolFactory;
Expand Down Expand Up @@ -48,6 +49,24 @@ public function test_async_client_factory(): void
$this->assertInstanceOf(SymfonyClient::class, $client);
}

public function test_invalid_pool_request(): void
{
$client = new ReactClient();

$clientPool = PoolFactory::createForClient($client);

$this->expectException(InvalidPoolRequestException::class);

$clientPool->send([1, 2, 3]);

$connectorPool = PoolFactory::createForConnector(
(new GenericConnector())->withClient($client)
);

$this->expectException(InvalidPoolRequestException::class);
$connectorPool->send([1, fn () => new \stdClass]);
}

public function test_create_pool_using_unsupported_client(): void
{
$pool = PoolFactory::createForConnector((new GenericConnector())->withClient(new Client()));
Expand Down

0 comments on commit 26c1c19

Please sign in to comment.