diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index c3c7e2c39624..854cab79dc20 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -888,7 +888,7 @@ public function delete(string $url, $data = []) * @param int|null $concurrency * @return array */ - public function pool(callable $callback, ?int $concurrency = null) + public function pool(callable $callback, ?int $concurrency = 0) { $results = []; diff --git a/tests/Http/HttpClientTest.php b/tests/Http/HttpClientTest.php index febc488c3a91..aac1afb564cf 100644 --- a/tests/Http/HttpClientTest.php +++ b/tests/Http/HttpClientTest.php @@ -3527,14 +3527,14 @@ public function testItCanEnforceFakingInThePool() $this->assertSame(200, $responses[0]->status()); $this->assertSame(200, $responses[1]->status()); - $this->expectException(StrayRequestException::class); - $this->expectExceptionMessage('Attempted request to [https://laravel.com] without a matching fake.'); - - $this->factory->pool(function (Pool $pool) { + [$exception] = $this->factory->pool(function (Pool $pool) { return [ $pool->get('https://laravel.com'), ]; }); + + $this->assertInstanceOf(StrayRequestException::class, $exception); + $this->assertEquals('Attempted request to [https://laravel.com] without a matching fake.', $exception->getMessage()); } public function testPreventingStrayRequests()