Skip to content

Commit 4ec083d

Browse files
committed
Merge branch '3.4' into 4.1
* 3.4: Fix: Adjust DocBlock \"ParserTest->getParserTestData()\" -> only some more tests [Lock] Pedantic improvements for lock [EventDispatcher] Fixed phpdoc on interface update year in license files [Console] Fix help text for single command applications Fix random test failure on lock improve error message when using test client without the BrowserKit component [Event Dispatcher] fixed 29703: TraceableEventDispatcher reset now sets callStack to null with test to dispatch after reset. Fixed minor typos Fix: Method can also return null [Stopwatch] Fixed phpdoc for category name
2 parents b7f63c9 + 38042a3 commit 4ec083d

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
2020
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
2121
use Symfony\Bundle\FullStack;
22+
use Symfony\Component\BrowserKit\Client;
2223
use Symfony\Component\Cache\Adapter\AbstractAdapter;
2324
use Symfony\Component\Cache\Adapter\AdapterInterface;
2425
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -190,6 +191,10 @@ public function load(array $configs, ContainerBuilder $container)
190191

191192
if (!empty($config['test'])) {
192193
$loader->load('test.xml');
194+
195+
if (!class_exists(Client::class)) {
196+
$container->removeDefinition('test.client');
197+
}
193198
}
194199

195200
if ($this->isConfigEnabled($container, $config['session'])) {

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2004-2018 Fabien Potencier
1+
Copyright (c) 2004-2019 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Test/WebTestCase.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Test;
1313

1414
use Symfony\Bundle\FrameworkBundle\Client;
15+
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
1516

1617
/**
1718
* WebTestCase is the base class for functional tests.
@@ -32,7 +33,12 @@ protected static function createClient(array $options = array(), array $server =
3233
{
3334
$kernel = static::bootKernel($options);
3435

35-
$client = $kernel->getContainer()->get('test.client');
36+
try {
37+
$client = $kernel->getContainer()->get('test.client');
38+
} 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".');
40+
}
41+
3642
$client->setServerParameters($server);
3743

3844
return $client;

0 commit comments

Comments
 (0)