diff --git a/composer.json b/composer.json index a49e1d64..0fceab97 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ }, "require-dev": { "dama/doctrine-test-bundle": "^8.0.1", - "doctrine/doctrine-bundle": "^2.7", + "doctrine/doctrine-bundle": "^2.17 || ^3.0", "doctrine/mongodb-odm": "^2.4", "doctrine/orm": "^2.14 || ^3.0", "friendsofphp/php-cs-fixer": "^3.4", diff --git a/tests/App/AppKernel.php b/tests/App/AppKernel.php index d1598b89..e1719b39 100644 --- a/tests/App/AppKernel.php +++ b/tests/App/AppKernel.php @@ -14,6 +14,7 @@ namespace Sonata\ClassificationBundle\Tests\App; use DAMA\DoctrineTestBundle\DAMADoctrineTestBundle; +use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\CacheCompatibilityPass; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use Knp\Bundle\MenuBundle\KnpMenuBundle; use Sonata\AdminBundle\SonataAdminBundle; @@ -32,7 +33,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; -use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\UX\StimulusBundle\StimulusBundle; final class AppKernel extends Kernel @@ -83,8 +83,13 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa { $loader->load(__DIR__.'/config/config.yaml'); - if (!class_exists(IsGranted::class)) { - $loader->load(__DIR__.'/config/config_symfony_v5.yaml'); + if (class_exists(CacheCompatibilityPass::class)) { + // doctrine-bundle v2 + $container->loadFromExtension('doctrine', [ + 'dbal' => [ + 'use_savepoints' => true, + ], + ]); } /* diff --git a/tests/App/config/config.yaml b/tests/App/config/config.yaml index aaaf9963..9633cd52 100644 --- a/tests/App/config/config.yaml +++ b/tests/App/config/config.yaml @@ -37,8 +37,6 @@ doctrine: dbal: driver: pdo_sqlite path: "%app.base_dir%sonata_classification_test.db3" - # "dama/doctrine-test-bundle" relies on savepoints. - use_savepoints: true orm: entity_managers: default: diff --git a/tests/App/config/config_symfony_v5.yaml b/tests/App/config/config_symfony_v5.yaml deleted file mode 100644 index f1e0ffdd..00000000 --- a/tests/App/config/config_symfony_v5.yaml +++ /dev/null @@ -1,2 +0,0 @@ -security: - enable_authenticator_manager: true diff --git a/tests/custom_bootstrap.php b/tests/custom_bootstrap.php index 23cdc3e7..b130403f 100644 --- a/tests/custom_bootstrap.php +++ b/tests/custom_bootstrap.php @@ -38,4 +38,8 @@ ]); $application->run($input, new NullOutput()); +$kernel->shutdown(); + (new Filesystem())->remove([$kernel->getCacheDir()]); + +restore_error_handler();