Skip tests that fatal-error on PHP 7.4 because of missing parent classes

This commit is contained in:
Nicolas Grekas 2019-08-01 14:16:51 +02:00
parent c06454827d
commit c2c7ba82df
6 changed files with 50 additions and 0 deletions

View File

@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer; namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
use PHPUnit\Framework\Warning;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait; use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer; use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase; use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@ -26,6 +27,10 @@ class ValidatorCacheWarmerTest extends TestCase
public function testWarmUp() public function testWarmUp()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$validatorBuilder = new ValidatorBuilder(); $validatorBuilder = new ValidatorBuilder();
$validatorBuilder->addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml'); $validatorBuilder->addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml');
$validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/author.yml'); $validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/author.yml');

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Config\Tests\Resource; namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Symfony\Component\Config\Resource\ClassExistenceResource; use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\Config\Tests\Fixtures\BadParent; use Symfony\Component\Config\Tests\Fixtures\BadParent;
use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass; use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass;
@ -77,6 +78,10 @@ EOF
public function testBadParentWithTimestamp() public function testBadParentWithTimestamp()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$res = new ClassExistenceResource(BadParent::class, false); $res = new ClassExistenceResource(BadParent::class, false);
$this->assertTrue($res->isFresh(time())); $this->assertTrue($res->isFresh(time()));
} }
@ -87,6 +92,10 @@ EOF
*/ */
public function testBadParentWithNoTimestamp() public function testBadParentWithNoTimestamp()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$res = new ClassExistenceResource(BadParent::class, false); $res = new ClassExistenceResource(BadParent::class, false);
$res->isFresh(0); $res->isFresh(0);
} }

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler; namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Compiler\AutowirePass; use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass; use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
@ -395,6 +396,10 @@ class AutowirePassTest extends TestCase
*/ */
public function testParentClassNotFoundThrowsException() public function testParentClassNotFoundThrowsException()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$aDefinition = $container->register('a', __NAMESPACE__.'\BadParentTypeHintedArgument'); $aDefinition = $container->register('a', __NAMESPACE__.'\BadParentTypeHintedArgument');
@ -707,6 +712,10 @@ class AutowirePassTest extends TestCase
public function testIgnoreServiceWithClassNotExisting() public function testIgnoreServiceWithClassNotExisting()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$container->register('class_not_exist', __NAMESPACE__.'\OptionalServiceClass'); $container->register('class_not_exist', __NAMESPACE__.'\OptionalServiceClass');
@ -917,6 +926,10 @@ class AutowirePassTest extends TestCase
*/ */
public function testExceptionWhenAliasDoesNotExist() public function testExceptionWhenAliasDoesNotExist()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$container = new ContainerBuilder(); $container = new ContainerBuilder();
// multiple I instances... but no IInterface alias // multiple I instances... but no IInterface alias

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler; namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Symfony\Component\DependencyInjection\Argument\BoundArgument; use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass; use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass; use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass;
@ -69,6 +70,10 @@ class ResolveBindingsPassTest extends TestCase
*/ */
public function testMissingParent() public function testMissingParent()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$definition = $container->register(ParentNotExists::class, ParentNotExists::class); $definition = $container->register(ParentNotExists::class, ParentNotExists::class);

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Dumper; namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait; use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\FileLocator;
@ -906,6 +907,10 @@ class PhpDumperTest extends TestCase
public function testHotPathOptimizations() public function testHotPathOptimizations()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$container = include self::$fixturesPath.'/containers/container_inline_requires.php'; $container = include self::$fixturesPath.'/containers/container_inline_requires.php';
$container->setParameter('inline_requires', true); $container->setParameter('inline_requires', true);
$container->compile(); $container->compile();

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Loader; namespace Symfony\Component\DependencyInjection\Tests\Loader;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use Psr\Container\ContainerInterface as PsrContainerInterface; use Psr\Container\ContainerInterface as PsrContainerInterface;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait; use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\FileLocator;
@ -112,6 +113,10 @@ class FileLoaderTest extends TestCase
public function testRegisterClassesWithExclude() public function testRegisterClassesWithExclude()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$container->setParameter('other_dir', 'OtherDir'); $container->setParameter('other_dir', 'OtherDir');
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures')); $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
@ -141,6 +146,10 @@ class FileLoaderTest extends TestCase
public function testNestedRegisterClasses() public function testNestedRegisterClasses()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures')); $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
@ -169,6 +178,10 @@ class FileLoaderTest extends TestCase
public function testMissingParentClass() public function testMissingParentClass()
{ {
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$container->setParameter('bad_classes_dir', 'BadClasses'); $container->setParameter('bad_classes_dir', 'BadClasses');
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures')); $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));