Skip to content

Commit 9f0bd42

Browse files
jderussenicolas-grekas
authored andcommitted
Replace warning by isolated test
1 parent 8899349 commit 9f0bd42

File tree

4 files changed

+24
-33
lines changed

4 files changed

+24
-33
lines changed

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

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

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();

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)