Skip to content

Commit 4b38150

Browse files
Merge branch '3.3' into 3.4
* 3.3: Display a nice error message if the form/serializer component is missing. Force phpunit-bridge update (bis) [Bridge/PhpUnit] Fix disabling global state preservation
2 parents 2a98bba + f0270a8 commit 4b38150

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env php
22
<?php
33

4-
// Cache-Id: https://github.com/symfony/phpunit-bridge/commit/3646664aa952fe13e9a612a726cbb38e02249793
4+
// Cache-Id: https://github.com/symfony/phpunit-bridge/commit/66ffffcd8a6bb23aec847c8bdfb918610399499a
55

66
if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
77
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ public function startTestSuite($suite)
106106
$suiteName = $suite->getName();
107107
$this->testsWithWarnings = array();
108108

109+
foreach ($suite->tests() as $test) {
110+
if (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
111+
continue;
112+
}
113+
if (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
114+
$test->setPreserveGlobalState(false);
115+
}
116+
}
117+
109118
if (-1 === $this->state) {
110119
echo "Testing $suiteName\n";
111120
$this->state = 0;
@@ -141,10 +150,6 @@ public function startTestSuite($suite)
141150
if (in_array('dns-sensitive', $groups, true)) {
142151
DnsMock::register($test->getName());
143152
}
144-
} elseif (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
145-
// no-op
146-
} elseif (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
147-
$test->setPreserveGlobalState(false);
148153
}
149154
}
150155
}
@@ -155,8 +160,6 @@ public function startTestSuite($suite)
155160
|| isset($this->wasSkipped[$suiteName]['*'])
156161
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
157162
$skipped[] = $test;
158-
} elseif (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
159-
$test->setPreserveGlobalState(false);
160163
}
161164
}
162165
$suite->setTests($skipped);

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
// Please update when phpunit needs to be reinstalled with fresh deps:
14-
// Cache-Id-Version: 2017-11-22 09:00 UTC
14+
// Cache-Id-Version: 2017-11-22 09:30 UTC
1515

1616
error_reporting(-1);
1717

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ public function load(array $configs, ContainerBuilder $container)
178178
throw new LogicException('Translation support cannot be enabled as the Translation component is not installed.');
179179
}
180180

181-
if (!class_exists('Symfony\Component\Translation\Translator') && $this->isConfigEnabled($container, $config['validation'])) {
182-
throw new LogicException('Validation support cannot be enabled as the Translation component is not installed.');
183-
}
184-
185181
if (class_exists(Translator::class)) {
186182
$loader->load('identity_translator.xml');
187183
}
@@ -232,6 +228,10 @@ public function load(array $configs, ContainerBuilder $container)
232228
}
233229

234230
if ($this->isConfigEnabled($container, $config['form'])) {
231+
if (!class_exists('Symfony\Component\Form\Form')) {
232+
throw new LogicException('Form support cannot be enabled as the Form component is not installed.');
233+
}
234+
235235
$this->formConfigEnabled = true;
236236
$this->registerFormConfiguration($config, $container, $loader);
237237

@@ -279,6 +279,10 @@ public function load(array $configs, ContainerBuilder $container)
279279
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
280280

281281
if ($this->isConfigEnabled($container, $config['serializer'])) {
282+
if (!class_exists('Symfony\Component\Serializer\Serializer')) {
283+
throw new LogicException('Serializer support cannot be enabled as the Serializer component is not installed.');
284+
}
285+
282286
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
283287
}
284288

0 commit comments

Comments
 (0)