From eafb6b60a9106e060826156d4213b019f6c26a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Sun, 3 Sep 2023 10:54:24 +0200 Subject: [PATCH] Improve deprecation layers in tests --- Tests/DependencyInjection/AbstractDoctrineExtensionTest.php | 1 + Tests/DependencyInjection/Compiler/IdGeneratorPassTest.php | 5 +++-- Tests/DependencyInjection/Fixtures/TestKernel.php | 5 +++-- .../DependencyInjection/Fixtures/config/xml/orm_filters.xml | 2 +- .../DependencyInjection/Fixtures/config/yml/orm_filters.yml | 1 + Tests/LockStoreSchemaListenerTest.php | 2 +- Tests/ServiceRepositoryTest.php | 5 +++-- Tests/baseline-ignore | 1 - composer.json | 1 + phpunit.xml.dist | 4 ---- 10 files changed, 14 insertions(+), 13 deletions(-) delete mode 100644 Tests/baseline-ignore diff --git a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php index d56d95f7c..c7271f698 100644 --- a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php +++ b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php @@ -874,6 +874,7 @@ public function testAddCustomHydrationMode(): void $this->assertDICDefinitionMethodCallOnce($definition, 'addCustomHydrationMode', ['test_hydrator', TestHydrator::class]); } + /** @requires PHP 8.1 */ public function testAddFilter(): void { if (! interface_exists(EntityManagerInterface::class)) { diff --git a/Tests/DependencyInjection/Compiler/IdGeneratorPassTest.php b/Tests/DependencyInjection/Compiler/IdGeneratorPassTest.php index 83ccdb317..c3525f541 100644 --- a/Tests/DependencyInjection/Compiler/IdGeneratorPassTest.php +++ b/Tests/DependencyInjection/Compiler/IdGeneratorPassTest.php @@ -93,10 +93,10 @@ public function testRepositoryServiceWiring(): void 'framework' => [ 'http_method_override' => false, 'annotations' => [ - 'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 64000, + 'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 60400, ], 'php_errors' => ['log' => true], - ] + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []), + ] + (Kernel::VERSION_ID >= 60200 ? ['handle_all_throwables' => true] : []), ], $container); $extension = new DoctrineExtension(); @@ -111,6 +111,7 @@ public function testRepositoryServiceWiring(): void 'orm' => [ 'mappings' => $mappings, 'report_fields_where_declared' => true, + 'enable_lazy_ghost_objects' => PHP_VERSION_ID >= 80100, ], ], ], $container); diff --git a/Tests/DependencyInjection/Fixtures/TestKernel.php b/Tests/DependencyInjection/Fixtures/TestKernel.php index 84b632c03..5ef053ccd 100644 --- a/Tests/DependencyInjection/Fixtures/TestKernel.php +++ b/Tests/DependencyInjection/Fixtures/TestKernel.php @@ -42,9 +42,9 @@ public function registerContainerConfiguration(LoaderInterface $loader): void $container->loadFromExtension('framework', [ 'secret' => 'F00', 'http_method_override' => false, - 'annotations' => class_exists(Annotation::class) && Kernel::VERSION_ID <= 64000, + 'annotations' => class_exists(Annotation::class) && Kernel::VERSION_ID <= 60400, 'php_errors' => ['log' => true], - ] + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : [])); + ] + (Kernel::VERSION_ID >= 60200 ? ['handle_all_throwables' => true] : [])); $container->loadFromExtension('doctrine', [ 'dbal' => [ 'driver' => 'pdo_sqlite', @@ -53,6 +53,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void 'orm' => [ 'report_fields_where_declared' => true, 'auto_generate_proxy_classes' => true, + 'enable_lazy_ghost_objects' => PHP_VERSION_ID >= 80100, 'mappings' => [ 'RepositoryServiceBundle' => [ 'type' => PHP_VERSION_ID >= 80000 ? 'attribute' : 'annotation', diff --git a/Tests/DependencyInjection/Fixtures/config/xml/orm_filters.xml b/Tests/DependencyInjection/Fixtures/config/xml/orm_filters.xml index 7f4c6d4f4..5d8723760 100644 --- a/Tests/DependencyInjection/Fixtures/config/xml/orm_filters.xml +++ b/Tests/DependencyInjection/Fixtures/config/xml/orm_filters.xml @@ -11,7 +11,7 @@ - + Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter myValue diff --git a/Tests/DependencyInjection/Fixtures/config/yml/orm_filters.yml b/Tests/DependencyInjection/Fixtures/config/yml/orm_filters.yml index 68e10d39c..cdd80a0e5 100644 --- a/Tests/DependencyInjection/Fixtures/config/yml/orm_filters.yml +++ b/Tests/DependencyInjection/Fixtures/config/yml/orm_filters.yml @@ -6,6 +6,7 @@ doctrine: dbname: db orm: + enable_lazy_ghost_objects: true filters: soft_delete: class: Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter diff --git a/Tests/LockStoreSchemaListenerTest.php b/Tests/LockStoreSchemaListenerTest.php index b8e2989fd..6e9d52cc8 100644 --- a/Tests/LockStoreSchemaListenerTest.php +++ b/Tests/LockStoreSchemaListenerTest.php @@ -55,7 +55,7 @@ public function testLockStoreSchemaSubscriberWiring(array $config, int $expected $extension->load( [ 'framework' => ['http_method_override' => false, 'php_errors' => ['log' => true]] - + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []) + $config, + + (Kernel::VERSION_ID >= 60200 ? ['handle_all_throwables' => true] : []) + $config, ], $container ); diff --git a/Tests/ServiceRepositoryTest.php b/Tests/ServiceRepositoryTest.php index f359c0d45..3f2a3e5c0 100644 --- a/Tests/ServiceRepositoryTest.php +++ b/Tests/ServiceRepositoryTest.php @@ -74,9 +74,9 @@ public function testRepositoryServiceWiring(): void 'http_method_override' => false, 'php_errors' => ['log' => true], 'annotations' => [ - 'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 64000, + 'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 60400, ], - ] + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []), + ] + (Kernel::VERSION_ID >= 60200 ? ['handle_all_throwables' => true] : []), ], $container); $extension = new DoctrineExtension(); @@ -90,6 +90,7 @@ public function testRepositoryServiceWiring(): void ], 'orm' => [ 'report_fields_where_declared' => true, + 'enable_lazy_ghost_objects' => PHP_VERSION_ID >= 80100, 'mappings' => [ 'RepositoryServiceBundle' => [ 'type' => PHP_VERSION_ID >= 80000 ? 'attribute' : 'annotation', diff --git a/Tests/baseline-ignore b/Tests/baseline-ignore deleted file mode 100644 index c20ab3ad2..000000000 --- a/Tests/baseline-ignore +++ /dev/null @@ -1 +0,0 @@ -%Not enabling lazy ghost objects is deprecated and will not be supported in Doctrine ORM 3% \ No newline at end of file diff --git a/composer.json b/composer.json index 269c4c27f..3ca274139 100644 --- a/composer.json +++ b/composer.json @@ -60,6 +60,7 @@ "symfony/string": "^5.4 || ^6.0", "symfony/twig-bridge": "^5.4 || ^6.0", "symfony/validator": "^5.4 || ^6.0", + "symfony/var-exporter": "^5.4 || 6.0 || ^7.0", "symfony/web-profiler-bundle": "^5.4 || ^6.0", "symfony/yaml": "^5.4 || ^6.0", "twig/twig": "^1.34 || ^2.12 || ^3.0", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 59a8f7c96..e48328406 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,10 +7,6 @@ - - - - .