Skip to content

Commit e50231c

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: Fix: Adjust DocBlock \"ParserTest->getParserTestData()\" -> only some more tests access the container getting it from the kernel [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 025e134 + 4ec083d commit e50231c

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

Command/AssetsInstallCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9696
$targetArg = rtrim($input->getArgument('target'), '/');
9797

9898
if (!$targetArg) {
99-
$targetArg = $this->getPublicDirectory($this->getContainer());
99+
$targetArg = $this->getPublicDirectory($kernel->getContainer());
100100
}
101101

102102
if (!is_dir($targetArg)) {

DependencyInjection/FrameworkExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2222
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
2323
use Symfony\Bundle\FullStack;
24+
use Symfony\Component\BrowserKit\Client;
2425
use Symfony\Component\Cache\Adapter\AbstractAdapter;
2526
use Symfony\Component\Cache\Adapter\AdapterInterface;
2627
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -197,6 +198,10 @@ public function load(array $configs, ContainerBuilder $container)
197198

198199
if (!empty($config['test'])) {
199200
$loader->load('test.xml');
201+
202+
if (!class_exists(Client::class)) {
203+
$container->removeDefinition('test.client');
204+
}
200205
}
201206

202207
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)