From 00dab3e78da6c2822d7ab4acca18d5806534a503 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sat, 16 Dec 2023 16:10:07 +0100 Subject: [PATCH] Remove some deprecations in tests --- composer.json | 2 +- tests/App/AppKernel.php | 2 ++ tests/App/DataFixtures/MongoDB/BookFixtures.php | 8 ++------ tests/App/config/config_symfony_v6.yaml | 11 +++++++++++ 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 tests/App/config/config_symfony_v6.yaml diff --git a/composer.json b/composer.json index 8d47f359..58693170 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "twig/twig": "^3.0" }, "require-dev": { - "doctrine/data-fixtures": "^1.4", + "doctrine/data-fixtures": "^1.6", "friendsofphp/php-cs-fixer": "^3.4", "matthiasnoback/symfony-config-test": "^4.2", "matthiasnoback/symfony-dependency-injection-test": "^4.1", diff --git a/tests/App/AppKernel.php b/tests/App/AppKernel.php index 9cfde43d..f92a56dd 100644 --- a/tests/App/AppKernel.php +++ b/tests/App/AppKernel.php @@ -79,6 +79,8 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa if (!class_exists(IsGranted::class)) { $loader->load(__DIR__.'/config/config_symfony_v5.yaml'); + } else { + $loader->load(__DIR__.'/config/config_symfony_v6.yaml'); } if (class_exists(HttpCacheHandler::class)) { diff --git a/tests/App/DataFixtures/MongoDB/BookFixtures.php b/tests/App/DataFixtures/MongoDB/BookFixtures.php index 7fcd8226..39ee655e 100644 --- a/tests/App/DataFixtures/MongoDB/BookFixtures.php +++ b/tests/App/DataFixtures/MongoDB/BookFixtures.php @@ -24,15 +24,11 @@ final class BookFixtures extends Fixture implements DependentFixtureInterface { public function load(ObjectManager $manager): void { - $author = $this->getReference(AuthorFixtures::AUTHOR); - - \assert($author instanceof Author); + $author = $this->getReference(AuthorFixtures::AUTHOR, Author::class); $book = new Book('book_id', 'Don Quixote', $author); - $category = $this->getReference(CategoryFixtures::CATEGORY); - - \assert($category instanceof Category); + $category = $this->getReference(CategoryFixtures::CATEGORY, Category::class); $book->addCategory($category); diff --git a/tests/App/config/config_symfony_v6.yaml b/tests/App/config/config_symfony_v6.yaml new file mode 100644 index 00000000..09970396 --- /dev/null +++ b/tests/App/config/config_symfony_v6.yaml @@ -0,0 +1,11 @@ +framework: + annotations: false + handle_all_throwables: true + php_errors: + log: true + session: + cookie_secure: auto + cookie_samesite: lax + handler_id: null + validation: + email_validation_mode: html5