Merge branch '3.4' into 4.0

* 3.4:
  [Lock][Process][FrameworkBundle] fix tests
  Display a nice error message if the form/serializer component is missing.
  [SecurityBundle] providerIds is undefined error when firewall provider is not specified
  [SecurityBundle] providerIds is undefined error when firewall provider is not specified
  [SecurityBundle] providerIds is undefined error when firewall provider is not specified
  Force phpunit-bridge update (bis)
  [Bridge/PhpUnit] Fix disabling global state preservation
  Incorrect dot on method loadChoices in upgrade doc
This commit is contained in:
Nicolas Grekas 2017-11-22 13:29:35 +01:00
commit ae3b5de58d
9 changed files with 31 additions and 33 deletions

View File

@ -323,7 +323,7 @@ Form
```php
class MyTimezoneType extends AbstractType
{
public function. getParent()
public function getParent()
{
return TimezoneType::class;
}

View File

@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php
// Cache-Id: https://github.com/symfony/phpunit-bridge/commit/3646664aa952fe13e9a612a726cbb38e02249793
// Cache-Id: https://github.com/symfony/phpunit-bridge/commit/66ffffcd8a6bb23aec847c8bdfb918610399499a
if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";

View File

@ -97,6 +97,15 @@ class SymfonyTestsListenerTrait
$suiteName = $suite->getName();
$this->testsWithWarnings = array();
foreach ($suite->tests() as $test) {
if (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
continue;
}
if (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
$test->setPreserveGlobalState(false);
}
}
if (-1 === $this->state) {
echo "Testing $suiteName\n";
$this->state = 0;
@ -132,10 +141,6 @@ class SymfonyTestsListenerTrait
if (in_array('dns-sensitive', $groups, true)) {
DnsMock::register($test->getName());
}
} elseif (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
// no-op
} elseif (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
$test->setPreserveGlobalState(false);
}
}
}
@ -146,8 +151,6 @@ class SymfonyTestsListenerTrait
|| isset($this->wasSkipped[$suiteName]['*'])
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
$skipped[] = $test;
} elseif (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
$test->setPreserveGlobalState(false);
}
}
$suite->setTests($skipped);

View File

@ -11,7 +11,7 @@
*/
// Please update when phpunit needs to be reinstalled with fresh deps:
// Cache-Id-Version: 2017-11-22 09:00 UTC
// Cache-Id-Version: 2017-11-22 09:30 UTC
error_reporting(-1);

View File

@ -137,10 +137,6 @@ class FrameworkExtension extends Extension
throw new LogicException('Translation support cannot be enabled as the Translation component is not installed.');
}
if (!class_exists('Symfony\Component\Translation\Translator') && $this->isConfigEnabled($container, $config['validation'])) {
throw new LogicException('Validation support cannot be enabled as the Translation component is not installed.');
}
if (class_exists(Translator::class)) {
$loader->load('identity_translator.xml');
}
@ -184,6 +180,10 @@ class FrameworkExtension extends Extension
}
if ($this->isConfigEnabled($container, $config['form'])) {
if (!class_exists('Symfony\Component\Form\Form')) {
throw new LogicException('Form support cannot be enabled as the Form component is not installed.');
}
$this->formConfigEnabled = true;
$this->registerFormConfiguration($config, $container, $loader);
@ -231,6 +231,10 @@ class FrameworkExtension extends Extension
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
if ($this->isConfigEnabled($container, $config['serializer'])) {
if (!class_exists('Symfony\Component\Serializer\Serializer')) {
throw new LogicException('Serializer support cannot be enabled as the Serializer component is not installed.');
}
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
}
@ -923,6 +927,7 @@ class FrameworkExtension extends Extension
return 2 === substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename());
})
->in($dirs)
->sortByName()
;
foreach ($finder as $file) {
@ -1032,7 +1037,7 @@ class FrameworkExtension extends Extension
private function registerMappingFilesFromDir($dir, callable $fileRecorder)
{
foreach (Finder::create()->followLinks()->files()->in($dir)->name('/\.(xml|ya?ml)$/') as $file) {
foreach (Finder::create()->followLinks()->files()->in($dir)->name('/\.(xml|ya?ml)$/')->sortByName() as $file) {
$fileRecorder($file->getExtension(), $file->getRealPath());
}
}

View File

@ -349,7 +349,7 @@ class SecurityExtension extends Extension
// Switch user listener
if (isset($firewall['switch_user'])) {
$listenerKeys[] = 'switch_user';
$listeners[] = new Reference($this->createSwitchUserListener($container, $id, $firewall['switch_user'], $defaultProvider, $firewall['stateless']));
$listeners[] = new Reference($this->createSwitchUserListener($container, $id, $firewall['switch_user'], $defaultProvider, $firewall['stateless'], $providerIds));
}
// Access listener
@ -594,7 +594,7 @@ class SecurityExtension extends Extension
return $exceptionListenerId;
}
private function createSwitchUserListener($container, $id, $config, $defaultProvider = null, $stateless)
private function createSwitchUserListener($container, $id, $config, $defaultProvider, $stateless, $providerIds)
{
$userProvider = isset($config['provider']) ? $this->getUserProviderId($config['provider']) : $defaultProvider;

View File

@ -30,7 +30,7 @@
"symfony/dom-crawler": "~3.4|~4.0",
"symfony/event-dispatcher": "~3.4|~4.0",
"symfony/form": "~3.4|~4.0",
"symfony/framework-bundle": "~3.4|~4.0",
"symfony/framework-bundle": "~3.4-rc1|~4.0-rc1",
"symfony/http-foundation": "~3.4|~4.0",
"symfony/translation": "~3.4|~4.0",
"symfony/twig-bundle": "~3.4|~4.0",
@ -40,7 +40,7 @@
"symfony/var-dumper": "~3.4|~4.0",
"symfony/yaml": "~3.4|~4.0",
"symfony/expression-language": "~3.4|~4.0",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/doctrine-bundle": "~1.5",
"twig/twig": "~1.34|~2.4"
},
"conflict": {

View File

@ -26,7 +26,10 @@ class MemcachedStoreTest extends AbstractStoreTest
{
$memcached = new \Memcached();
$memcached->addServer(getenv('MEMCACHED_HOST'), 11211);
if (false === $memcached->getStats()) {
$memcached->get('foo');
$code = $memcached->getResultCode();
if (\Memcached::RES_SUCCESS !== $code && \Memcached::RES_NOTFOUND !== $code) {
self::markTestSkipped('Unable to connect to the memcache host');
}
}

View File

@ -1452,20 +1452,7 @@ Array
)
EOTXT;
if (\PHP_VERSION_ID >= 70200) {
$expected = <<<EOTXT
Array
(
[0] => Standard input code
[1] => a
[2] =>
[3] => b
)
EOTXT;
}
$this->assertSame($expected, $p->getOutput());
$this->assertSame($expected, str_replace('Standard input code', '-', $p->getOutput()));
}
public function provideEscapeArgument()