From 9e4e191535468a3a08023031be69eb07a3f72f35 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 13 Sep 2019 11:27:15 +0200 Subject: [PATCH] Re-enable previously failing PHP 7.4 test cases --- .travis.yml | 11 ----------- .../PhpUnit/DeprecationErrorHandler.php | 4 ++-- .../CacheWarmer/ValidatorCacheWarmerTest.php | 5 ----- .../Tests/Command/YamlLintCommandTest.php | 19 +------------------ .../Resource/ClassExistenceResourceTest.php | 10 ---------- src/Symfony/Component/Debug/ErrorHandler.php | 3 +-- .../Tests/Compiler/AutowirePassTest.php | 15 --------------- .../Compiler/ResolveBindingsPassTest.php | 5 ----- .../Tests/Dumper/PhpDumperTest.php | 5 ----- .../Tests/Loader/FileLoaderTest.php | 15 --------------- .../Component/Process/Tests/ProcessTest.php | 2 +- 11 files changed, 5 insertions(+), 89 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45ffe08cb3c1d..f6bada98461b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,11 +28,6 @@ matrix: env: deps=high - php: 7.4snapshot env: deps=low - - php: 7.4snapshot - env: deps= - allow_failures: - - php: 7.4snapshot - env: deps= fast_finish: true cache: @@ -76,12 +71,6 @@ before_install: export COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n' | sort) find ~/.phpenv -name xdebug.ini -delete - if [[ $TRAVIS_PHP_VERSION = 7.4* && $deps ]]; then - export PHPUNIT_X="$PHPUNIT_X,issue-32995" - elif [[ $TRAVIS_PHP_VERSION = 7.4* ]]; then - export PHPUNIT_X="$PHPUNIT --group issue-32995" - fi - if [[ $TRAVIS_PHP_VERSION = 5.* || $TRAVIS_PHP_VERSION = hhvm* ]]; then composer () { $HOME/.phpenv/versions/7.1/bin/php $HOME/.phpenv/versions/7.1/bin/composer config platform.php $(echo ' array(), ); $deprecationHandler = function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) { - if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode = $getMode()) { + if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type && (E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) || DeprecationErrorHandler::MODE_DISABLED === $mode = $getMode()) { return \call_user_func(DeprecationErrorHandler::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context); } @@ -285,7 +285,7 @@ public static function collectDeprecations($outputFile) { $deprecations = array(); $previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, &$previousErrorHandler) { - if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { + if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type && (E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) { if ($previousErrorHandler) { return $previousErrorHandler($type, $msg, $file, $line, $context); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php index e43659b95632a..33d1140351cda 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php @@ -21,11 +21,6 @@ class ValidatorCacheWarmerTest extends TestCase { - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testWarmUp() { $validatorBuilder = new ValidatorBuilder(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php index 410ab4f90c8fc..ba883543cadb0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php @@ -72,29 +72,12 @@ public function testGetHelp() { $command = new YamlLintCommand(); $expected = <<%command.name% command lints a YAML file and outputs to STDOUT -the first encountered syntax error. - -You can validates YAML contents passed from STDIN: - - cat filename | php %command.full_name% - -You can also validate the syntax of a file: - - php %command.full_name% filename - -Or of a whole directory: - - php %command.full_name% dirname - php %command.full_name% dirname --format=json - Or find all files in a bundle: php %command.full_name% @AcmeDemoBundle - EOF; - $this->assertEquals($expected, $command->getHelp()); + $this->assertStringContainsString($expected, $command->getHelp()); } public function testLintFilesFromBundleDirectory() diff --git a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php index f096b376368f1..6b38e33baf4a2 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php @@ -75,22 +75,12 @@ public function testExistsKo() } } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testBadParentWithTimestamp() { $res = new ClassExistenceResource(BadParent::class, false); $this->assertTrue($res->isFresh(time())); } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testBadParentWithNoTimestamp() { $this->expectException('ReflectionException'); diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 794f5ca029ea0..1b39fab5ca401 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -382,8 +382,7 @@ private function reRegister($prev) */ public function handleError($type, $message, $file, $line) { - // @deprecated to be removed in Symfony 5.0 - if (\PHP_VERSION_ID >= 70300 && $message && '"' === $message[0] && 0 === strpos($message, '"continue') && preg_match('/^"continue(?: \d++)?" targeting switch is equivalent to "break(?: \d++)?"\. Did you mean to use "continue(?: \d++)?"\?$/', $message)) { + if (\PHP_VERSION_ID >= 70300 && E_WARNING === $type && '"' === $message[0] && false !== strpos($message, '" targeting switch is equivalent to "break')) { $type = E_DEPRECATED; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php index b2a08c4d6ece4..f729f72ba0dba 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php @@ -377,11 +377,6 @@ public function testClassNotFoundThrowsException() $pass->process($container); } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testParentClassNotFoundThrowsException() { $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException'); @@ -693,11 +688,6 @@ public function getCreateResourceTests() ]; } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testIgnoreServiceWithClassNotExisting() { $container = new ContainerBuilder(); @@ -896,11 +886,6 @@ public function testExceptionWhenAliasExists() $pass->process($container); } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testExceptionWhenAliasDoesNotExist() { $this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php index 9a6404b5c4ee8..a44fea4d60e08 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php @@ -61,11 +61,6 @@ public function testUnusedBinding() $pass->process($container); } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testMissingParent() { $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index c63380d3d96c3..4e6083d99814f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -893,11 +893,6 @@ public function testInlineSelfRef() $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_inline_self_ref.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Inline_Self_Ref'])); } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testHotPathOptimizations() { $container = include self::$fixturesPath.'/containers/container_inline_requires.php'; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php index c5f1725fb05fb..b6a816e40898e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php @@ -107,11 +107,6 @@ public function testRegisterClasses() ); } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testRegisterClassesWithExclude() { $container = new ContainerBuilder(); @@ -141,11 +136,6 @@ public function testRegisterClassesWithExclude() ); } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testNestedRegisterClasses() { $container = new ContainerBuilder(); @@ -174,11 +164,6 @@ public function testNestedRegisterClasses() $this->assertFalse($alias->isPrivate()); } - /** - * @group issue-32995 - * - * @runInSeparateProcess https://github.com/symfony/symfony/issues/32995 - */ public function testMissingParentClass() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index 9a7c515e8a5ec..18657f7309adf 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -75,7 +75,7 @@ public function testThatProcessDoesNotThrowWarningDuringRun() $process = $this->getProcessForCode('sleep(3)'); $process->run(); $actualError = error_get_last(); - $this->assertEquals('Test Error', $actualError['message']); + $this->assertEquals('Test Error', $actualError['message'], print_r($actualError, true)); $this->assertEquals(E_USER_NOTICE, $actualError['type']); }