diff --git a/packages/sortable-behavior-bundle/tests/App/Kernel.php b/packages/sortable-behavior-bundle/tests/App/Kernel.php index 250b450f..00d6517e 100644 --- a/packages/sortable-behavior-bundle/tests/App/Kernel.php +++ b/packages/sortable-behavior-bundle/tests/App/Kernel.php @@ -69,6 +69,8 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa 'test' => true, 'router' => ['utf8' => true], 'secret' => 'secret', + 'form' => ['enabled' => true], + 'property_access' => ['enabled' => true], ]); $container->loadFromExtension('security', [ diff --git a/packages/testing/src/TestCase/DoctrineTestCase.php b/packages/testing/src/TestCase/DoctrineTestCase.php index c4dd7734..3d8ff464 100644 --- a/packages/testing/src/TestCase/DoctrineTestCase.php +++ b/packages/testing/src/TestCase/DoctrineTestCase.php @@ -68,15 +68,19 @@ private function ensureSchemaIsCreated(): void return; } - static::$entityManager = static::$container->get(EntityManagerInterface::class); - static::$loader = static::$container->get('fidry_alice_data_fixtures.loader.doctrine'); - static::$connection = static::$container->get(Connection::class); - static::$containerBag = static::$container->get(ContainerBagInterface::class); + /* @phpstan-ignore-next-line */ + $container = method_exists(static::class, 'getContainer') ? static::getContainer() : static::$container; - static::$container->get(RequestStack::class)->push(new Request()); + static::$entityManager = $container->get(EntityManagerInterface::class); + static::$loader = $container->get('fidry_alice_data_fixtures.loader.doctrine'); + static::$connection = $container->get(Connection::class); + static::$containerBag = $container->get(ContainerBagInterface::class); + + $container->get(RequestStack::class)->push(new Request()); if (!class_exists(DatabaseResetter::class)) { $schemaTool = new SchemaTool(static::$entityManager); + $schemaTool->dropDatabase(); $schemaTool->createSchema(static::$entityManager->getMetadataFactory()->getAllMetadata()); } diff --git a/packages/testing/tests/App/Kernel.php b/packages/testing/tests/App/Kernel.php index 845b9e2f..cb087613 100644 --- a/packages/testing/tests/App/Kernel.php +++ b/packages/testing/tests/App/Kernel.php @@ -58,6 +58,8 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa 'test' => true, 'router' => ['utf8' => true], 'secret' => 'secret', + 'annotations' => ['enabled' => true], + 'property_access' => ['enabled' => true], ]); $container->loadFromExtension('doctrine', [