Skip to content

Commit

Permalink
Check if Client exists when test.client does not exist, to provide cl…
Browse files Browse the repository at this point in the history
…earer exception message
  • Loading branch information
SerkanYildiz authored and fabpot committed Mar 20, 2019
1 parent e9c8e19 commit b429950
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php
Expand Up @@ -36,7 +36,10 @@ protected static function createClient(array $options = [], array $server = [])
try {
$client = $kernel->getContainer()->get('test.client');
} catch (ServiceNotFoundException $e) {
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".');
if (class_exists(Client::class)) {
throw new \LogicException('You cannot create the client used in functional tests if the "framework.test" config is not set to true.');
}
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"');
}

$client->setServerParameters($server);
Expand Down

0 comments on commit b429950

Please sign in to comment.