Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7afc935

Browse files
minor #33069 Replace warning by isolated test (jderusse)
This PR was merged into the 3.4 branch. Discussion ---------- Replace warning by isolated test | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32844 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Failing test introduced in PHP 7.4 (fatal error) were skiped with a warning exception. This PR un tests is isolated process in order to correctly flag the test without stoping the test suite. I kept a comment to the original bug in order to easily remove theme Commits ------- 9c45a8e Replace warning by isolated test
2 parents 02a90d2 + 9c45a8e commit 7afc935

File tree

6 files changed

+33
-46
lines changed

6 files changed

+33
-46
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
1313

14-
use PHPUnit\Framework\Warning;
1514
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
1615
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1716
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -22,12 +21,11 @@
2221

2322
class ValidatorCacheWarmerTest extends TestCase
2423
{
24+
/**
25+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
26+
*/
2527
public function testWarmUp()
2628
{
27-
if (\PHP_VERSION_ID >= 70400) {
28-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
29-
}
30-
3129
$validatorBuilder = new ValidatorBuilder();
3230
$validatorBuilder->addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml');
3331
$validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/author.yml');

src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Config\Tests\Resource;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use PHPUnit\Framework\Warning;
1615
use Symfony\Component\Config\Resource\ClassExistenceResource;
1716
use Symfony\Component\Config\Tests\Fixtures\BadParent;
1817
use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass;
@@ -76,23 +75,22 @@ public function testExistsKo()
7675
}
7776
}
7877

78+
/**
79+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
80+
*/
7981
public function testBadParentWithTimestamp()
8082
{
81-
if (\PHP_VERSION_ID >= 70400) {
82-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
83-
}
84-
8583
$res = new ClassExistenceResource(BadParent::class, false);
8684
$this->assertTrue($res->isFresh(time()));
8785
}
8886

87+
/**
88+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
89+
*/
8990
public function testBadParentWithNoTimestamp()
9091
{
9192
$this->expectException('ReflectionException');
9293
$this->expectExceptionMessage('Class Symfony\Component\Config\Tests\Fixtures\MissingParent not found');
93-
if (\PHP_VERSION_ID >= 70400) {
94-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
95-
}
9694

9795
$res = new ClassExistenceResource(BadParent::class, false);
9896
$res->isFresh(0);

src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use PHPUnit\Framework\Warning;
1615
use Symfony\Component\Config\FileLocator;
1716
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
1817
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
@@ -378,13 +377,13 @@ public function testClassNotFoundThrowsException()
378377
$pass->process($container);
379378
}
380379

380+
/**
381+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
382+
*/
381383
public function testParentClassNotFoundThrowsException()
382384
{
383385
$this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
384386
$this->expectExceptionMessage('Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass" but this class is missing a parent class (Class Symfony\Bug\NotExistClass not found).');
385-
if (\PHP_VERSION_ID >= 70400) {
386-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
387-
}
388387

389388
$container = new ContainerBuilder();
390389

@@ -692,12 +691,11 @@ public function getCreateResourceTests()
692691
];
693692
}
694693

694+
/**
695+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
696+
*/
695697
public function testIgnoreServiceWithClassNotExisting()
696698
{
697-
if (\PHP_VERSION_ID >= 70400) {
698-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
699-
}
700-
701699
$container = new ContainerBuilder();
702700

703701
$container->register('class_not_exist', __NAMESPACE__.'\OptionalServiceClass');
@@ -894,13 +892,13 @@ public function testExceptionWhenAliasExists()
894892
$pass->process($container);
895893
}
896894

895+
/**
896+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
897+
*/
897898
public function testExceptionWhenAliasDoesNotExist()
898899
{
899900
$this->expectException('Symfony\Component\DependencyInjection\Exception\AutowiringFailedException');
900901
$this->expectExceptionMessage('Cannot autowire service "j": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\J::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\I" but no such service exists. You should maybe alias this class to one of these existing services: "i", "i2".');
901-
if (\PHP_VERSION_ID >= 70400) {
902-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
903-
}
904902

905903
$container = new ContainerBuilder();
906904

src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use PHPUnit\Framework\Warning;
1615
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
1716
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
1817
use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass;
@@ -62,13 +61,13 @@ public function testUnusedBinding()
6261
$pass->process($container);
6362
}
6463

64+
/**
65+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
66+
*/
6567
public function testMissingParent()
6668
{
6769
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
6870
$this->expectExceptionMessageRegExp('/Unused binding "\$quz" in service [\s\S]+/');
69-
if (\PHP_VERSION_ID >= 70400) {
70-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
71-
}
7271

7372
$container = new ContainerBuilder();
7473

src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use PHPUnit\Framework\Warning;
1615
use Psr\Container\ContainerInterface;
1716
use Symfony\Component\Config\FileLocator;
1817
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
@@ -894,12 +893,11 @@ public function testInlineSelfRef()
894893
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_inline_self_ref.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Inline_Self_Ref']));
895894
}
896895

896+
/**
897+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
898+
*/
897899
public function testHotPathOptimizations()
898900
{
899-
if (\PHP_VERSION_ID >= 70400) {
900-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
901-
}
902-
903901
$container = include self::$fixturesPath.'/containers/container_inline_requires.php';
904902
$container->setParameter('inline_requires', true);
905903
$container->compile();

src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Loader;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use PHPUnit\Framework\Warning;
1615
use Psr\Container\ContainerInterface as PsrContainerInterface;
1716
use Symfony\Component\Config\FileLocator;
1817
use Symfony\Component\Config\Loader\LoaderResolver;
@@ -108,12 +107,11 @@ public function testRegisterClasses()
108107
);
109108
}
110109

110+
/**
111+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
112+
*/
111113
public function testRegisterClassesWithExclude()
112114
{
113-
if (\PHP_VERSION_ID >= 70400) {
114-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
115-
}
116-
117115
$container = new ContainerBuilder();
118116
$container->setParameter('other_dir', 'OtherDir');
119117
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
@@ -141,12 +139,11 @@ public function testRegisterClassesWithExclude()
141139
);
142140
}
143141

142+
/**
143+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
144+
*/
144145
public function testNestedRegisterClasses()
145146
{
146-
if (\PHP_VERSION_ID >= 70400) {
147-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
148-
}
149-
150147
$container = new ContainerBuilder();
151148
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
152149

@@ -173,12 +170,11 @@ public function testNestedRegisterClasses()
173170
$this->assertFalse($alias->isPrivate());
174171
}
175172

173+
/**
174+
* @runInSeparateProcess https://github.com/symfony/symfony/issues/32995
175+
*/
176176
public function testMissingParentClass()
177177
{
178-
if (\PHP_VERSION_ID >= 70400) {
179-
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
180-
}
181-
182178
$container = new ContainerBuilder();
183179
$container->setParameter('bad_classes_dir', 'BadClasses');
184180
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));

0 commit comments

Comments
 (0)