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 fb09a89 commit ac75b95
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Test/WebTestCase.php
Original file line number Diff line number Diff line change
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 ac75b95

Please sign in to comment.