Skip to content

Commit ac75b95

Browse files
SerkanYildizfabpot
authored andcommitted
Check if Client exists when test.client does not exist, to provide clearer exception message
1 parent fb09a89 commit ac75b95

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Test/WebTestCase.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ protected static function createClient(array $options = [], array $server = [])
3636
try {
3737
$client = $kernel->getContainer()->get('test.client');
3838
} catch (ServiceNotFoundException $e) {
39-
throw new \LogicException('You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require symfony/browser-kit".');
39+
if (class_exists(Client::class)) {
40+
throw new \LogicException('You cannot create the client used in functional tests if the "framework.test" config is not set to true.');
41+
}
42+
throw new \LogicException('You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require symfony/browser-kit"');
4043
}
4144

4245
$client->setServerParameters($server);

0 commit comments

Comments
 (0)