From 5d96fb117a4286c31a00a44806d3bb6d61f244ca Mon Sep 17 00:00:00 2001 From: SonataCI Date: Wed, 27 Sep 2023 16:13:49 +0000 Subject: [PATCH 01/10] DevKit updates --- .php-cs-fixer.dist.php | 2 ++ rector.php | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 72c25056..1afe2e23 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -56,6 +56,8 @@ ]], 'php_unit_strict' => true, 'php_unit_test_case_static_method_calls' => true, + 'php_unit_data_provider_name' => true, + 'php_unit_data_provider_return_type' => true, 'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress', 'phpstan-var']], 'single_line_throw' => false, 'static_lambda' => true, diff --git a/rector.php b/rector.php index 6454e91a..74c4dcde 100644 --- a/rector.php +++ b/rector.php @@ -20,6 +20,9 @@ use Rector\Config\RectorConfig; use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; use Rector\Php71\Rector\FuncCall\CountOnNullRector; +use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector; +use Rector\PHPUnit\Set\PHPUnitLevelSetList; +use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { @@ -30,6 +33,8 @@ $rectorConfig->sets([ LevelSetList::UP_TO_PHP_80, + PHPUnitLevelSetList::UP_TO_PHPUNIT_90, + PHPUnitSetList::PHPUNIT_CODE_QUALITY, ]); $rectorConfig->importNames(); @@ -37,5 +42,6 @@ $rectorConfig->skip([ CountOnNullRector::class, ExceptionHandlerTypehintRector::class, + AddSeeTestAnnotationRector::class, ]); }; From 95cdf2d7d7942e95edf398abfa89b8207a5dc8b0 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Thu, 28 Sep 2023 12:12:51 +0000 Subject: [PATCH 02/10] DevKit updates --- rector.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rector.php b/rector.php index 74c4dcde..dd4380e3 100644 --- a/rector.php +++ b/rector.php @@ -21,6 +21,7 @@ use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; use Rector\Php71\Rector\FuncCall\CountOnNullRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector; +use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; use Rector\PHPUnit\Set\PHPUnitLevelSetList; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; @@ -43,5 +44,6 @@ CountOnNullRector::class, ExceptionHandlerTypehintRector::class, AddSeeTestAnnotationRector::class, + PreferPHPUnitThisCallRector::class, ]); }; From 4ef01eaef7da3af8e47b4f109527dc1d71d7ad87 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Thu, 28 Sep 2023 18:27:54 +0200 Subject: [PATCH 03/10] Fix --- composer.json | 2 +- tests/Checker/TranslatableCheckerTest.php | 4 ++-- tests/Functional/GedmoCRUDTest.php | 12 ++++++------ tests/Functional/KnpCRUDTest.php | 12 ++++++------ tests/Provider/Knplabs/LocaleProviderTest.php | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 1e187caf..e69508ce 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "phpunit/phpunit": "^9.5", "psalm/plugin-phpunit": "^0.18", "psalm/plugin-symfony": "^5.0", - "rector/rector": "^0.17", + "rector/rector": "^0.18", "sonata-project/doctrine-orm-admin-bundle": "^4.0", "symfony/browser-kit": "^5.4 || ^6.2", "symfony/css-selector": "^5.4 || ^6.2", diff --git a/tests/Checker/TranslatableCheckerTest.php b/tests/Checker/TranslatableCheckerTest.php index 96dd00dd..32f8c8c3 100644 --- a/tests/Checker/TranslatableCheckerTest.php +++ b/tests/Checker/TranslatableCheckerTest.php @@ -33,7 +33,7 @@ protected function setUp(): void /** * @return iterable, array}> */ - public function provideTestIsTranslatable(): iterable + public function provideIsTranslatableCases(): iterable { yield 'object-by-model' => [ new ModelCustomTranslatable(), @@ -61,7 +61,7 @@ public function provideTestIsTranslatable(): iterable } /** - * @dataProvider provideTestIsTranslatable + * @dataProvider provideIsTranslatableCases * * @phpstan-param object|class-string $classOrObject * @phpstan-param class-string[] $supportedModels diff --git a/tests/Functional/GedmoCRUDTest.php b/tests/Functional/GedmoCRUDTest.php index fc9edfb8..0980e1fe 100644 --- a/tests/Functional/GedmoCRUDTest.php +++ b/tests/Functional/GedmoCRUDTest.php @@ -28,7 +28,7 @@ protected function setUp(): void } /** - * @dataProvider provideLocales + * @dataProvider provideListCases */ public function testList(string $locale, string $name): void { @@ -42,7 +42,7 @@ public function testList(string $locale, string $name): void /** * @return iterable */ - public function provideLocales(): iterable + public function provideListCases(): iterable { yield 'default english' => ['', 'Novel']; yield 'english' => ['en', 'Novel']; @@ -51,7 +51,7 @@ public function provideLocales(): iterable } /** - * @dataProvider provideLocalesToCreate + * @dataProvider provideCreateCases */ public function testCreate(string $locale, string $newName): void { @@ -87,7 +87,7 @@ public function testCreate(string $locale, string $newName): void /** * @return iterable */ - public function provideLocalesToCreate(): iterable + public function provideCreateCases(): iterable { yield 'default english' => ['', 'Default New Novel']; yield 'english' => ['en', 'New Novel']; @@ -96,7 +96,7 @@ public function provideLocalesToCreate(): iterable } /** - * @dataProvider provideLocalesToEdit + * @dataProvider provideEditCases */ public function testEdit(string $locale, string $editedName): void { @@ -128,7 +128,7 @@ public function testEdit(string $locale, string $editedName): void /** * @return iterable */ - public function provideLocalesToEdit(): iterable + public function provideEditCases(): iterable { yield 'default english' => ['', 'Edited Default Novel']; yield 'english' => ['en', 'Edited Novel']; diff --git a/tests/Functional/KnpCRUDTest.php b/tests/Functional/KnpCRUDTest.php index 033ee0d8..66833ee1 100644 --- a/tests/Functional/KnpCRUDTest.php +++ b/tests/Functional/KnpCRUDTest.php @@ -28,7 +28,7 @@ protected function setUp(): void } /** - * @dataProvider provideLocales + * @dataProvider provideListCases */ public function testList(string $locale, string $name): void { @@ -42,7 +42,7 @@ public function testList(string $locale, string $name): void /** * @return iterable */ - public function provideLocales(): iterable + public function provideListCases(): iterable { yield 'default english' => ['', 'Novel']; yield 'english' => ['en', 'Novel']; @@ -51,7 +51,7 @@ public function provideLocales(): iterable } /** - * @dataProvider provideLocalesToCreate + * @dataProvider provideCreateCases */ public function testCreate(string $locale, string $newName): void { @@ -87,7 +87,7 @@ public function testCreate(string $locale, string $newName): void /** * @return iterable */ - public function provideLocalesToCreate(): iterable + public function provideCreateCases(): iterable { yield 'default english' => ['', 'Default New Novel']; yield 'english' => ['en', 'New Novel']; @@ -96,7 +96,7 @@ public function provideLocalesToCreate(): iterable } /** - * @dataProvider provideLocalesToEdit + * @dataProvider provideEditCases */ public function testEdit(string $locale, string $editedName): void { @@ -128,7 +128,7 @@ public function testEdit(string $locale, string $editedName): void /** * @return iterable */ - public function provideLocalesToEdit(): iterable + public function provideEditCases(): iterable { yield 'default english' => ['', 'Edited Default Novel']; yield 'english' => ['en', 'Edited Novel']; diff --git a/tests/Provider/Knplabs/LocaleProviderTest.php b/tests/Provider/Knplabs/LocaleProviderTest.php index 6dad1509..b6b210a1 100644 --- a/tests/Provider/Knplabs/LocaleProviderTest.php +++ b/tests/Provider/Knplabs/LocaleProviderTest.php @@ -23,7 +23,7 @@ final class LocaleProviderTest extends TestCase { /** - * @dataProvider provideValues + * @dataProvider provideUsesTheProperProviderBasedOnRequestCases */ public function testUsesTheProperProviderBasedOnRequest( string $expectedLocale, @@ -53,7 +53,7 @@ public function testUsesTheProperProviderBasedOnRequest( /** * @return iterable */ - public function provideValues(): iterable + public function provideUsesTheProperProviderBasedOnRequestCases(): iterable { yield 'with sonata enabled it uses sonata provider' => ['en', 'es', 'en', true]; yield 'with sonata disabled it uses knp provider' => ['es', 'es', 'en', false]; From b6f225c154d3be7dec657dc105a55a3154239361 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 14 Oct 2023 11:49:31 +0200 Subject: [PATCH 04/10] Fix --- src/Block/LocaleSwitcherBlockService.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Block/LocaleSwitcherBlockService.php b/src/Block/LocaleSwitcherBlockService.php index 341b7488..c13208b3 100644 --- a/src/Block/LocaleSwitcherBlockService.php +++ b/src/Block/LocaleSwitcherBlockService.php @@ -50,8 +50,6 @@ public function execute(BlockContextInterface $blockContext, ?Response $response { $template = $blockContext->getTemplate(); - \assert(\is_string($template)); - return $this->renderResponse($template, [ 'block_context' => $blockContext, 'block' => $blockContext->getBlock(), From dafd4c08cb13f224c3ef2ca74ff7e39eed532f6a Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 14 Oct 2023 12:11:09 +0200 Subject: [PATCH 05/10] Fix --- src/DependencyInjection/SonataTranslationExtension.php | 3 ++- tests/App/config/services.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DependencyInjection/SonataTranslationExtension.php b/src/DependencyInjection/SonataTranslationExtension.php index c50f1327..18ae265e 100644 --- a/src/DependencyInjection/SonataTranslationExtension.php +++ b/src/DependencyInjection/SonataTranslationExtension.php @@ -19,6 +19,7 @@ use Symfony\Component\Config\Definition\Processor; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\Extension; @@ -155,7 +156,7 @@ private function registerTranslatableListener(ContainerBuilder $container, array // Registration based on the documentation // see https://github.com/doctrine-extensions/DoctrineExtensions/blob/7c0d5aeab0f840d2a18a18c3dc10b0117c597a42/doc/symfony4.md#doctrine-extension-listener-services $container->register('sonata_translation.listener.translatable', TranslatableListener::class) - ->addMethodCall('setAnnotationReader', [new Reference('annotation_reader')]) + ->addMethodCall('setAnnotationReader', [new Reference('annotation_reader', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]) ->addMethodCall('setDefaultLocale', ['%locale%']) ->addMethodCall('setTranslatableLocale', ['%locale%']) ->addMethodCall('setTranslationFallback', [false]) diff --git a/tests/App/config/services.php b/tests/App/config/services.php index 3f3e08a1..798b67e2 100644 --- a/tests/App/config/services.php +++ b/tests/App/config/services.php @@ -42,7 +42,7 @@ ]) ->set('app.gedmo.translation_listener', TranslatableListener::class) - ->call('setAnnotationReader', [service('annotation_reader')]) + ->call('setAnnotationReader', [service('annotation_reader')->ignoreOnInvalid()]) ->call('setDefaultLocale', [param('locale')]) ->call('setTranslationFallback', [false]) ->tag('doctrine.event_subscriber'); From f98d6cfee274e8fdfdd43b8d8ff3f2af963569e3 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sun, 19 Nov 2023 20:12:07 +0000 Subject: [PATCH 06/10] DevKit updates --- .github/workflows/test.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 66adebd9..9825f9fe 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -42,10 +42,6 @@ jobs: dependencies: lowest allowed-to-fail: false variant: normal - - php-version: '8.2' - dependencies: highest - allowed-to-fail: false - variant: sonata-project/block-bundle:"5.0.0-alpha-1" - php-version: '8.2' dependencies: highest allowed-to-fail: false From 4dcb9ddaf6747347f448fcf8e94674b6d28b1cb8 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Thu, 7 Dec 2023 04:12:59 +0000 Subject: [PATCH 07/10] DevKit updates --- rector.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/rector.php b/rector.php index dd4380e3..2456d3ec 100644 --- a/rector.php +++ b/rector.php @@ -19,7 +19,6 @@ use Rector\Config\RectorConfig; use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; -use Rector\Php71\Rector\FuncCall\CountOnNullRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; use Rector\PHPUnit\Set\PHPUnitLevelSetList; @@ -41,7 +40,6 @@ $rectorConfig->importNames(); $rectorConfig->importShortClasses(false); $rectorConfig->skip([ - CountOnNullRector::class, ExceptionHandlerTypehintRector::class, AddSeeTestAnnotationRector::class, PreferPHPUnitThisCallRector::class, From 297e34e7e9f96d18274a7672f66b1350401b351a Mon Sep 17 00:00:00 2001 From: SonataCI Date: Thu, 7 Dec 2023 16:12:29 +0000 Subject: [PATCH 08/10] DevKit updates --- .github/workflows/test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9825f9fe..667bd681 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -50,13 +50,13 @@ jobs: - php-version: '8.2' dependencies: highest allowed-to-fail: false - symfony-require: 6.2.* - variant: symfony/symfony:"6.2.*" + symfony-require: 6.3.* + variant: symfony/symfony:"6.3.*" - php-version: '8.2' dependencies: highest allowed-to-fail: false - symfony-require: 6.3.* - variant: symfony/symfony:"6.3.*" + symfony-require: 6.4.* + variant: symfony/symfony:"6.4.*" steps: - name: Checkout From 0d75b2bbc6e307eb1187cf6ba5244f4f80bd2c85 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sat, 16 Dec 2023 10:31:36 +0100 Subject: [PATCH 09/10] Fix tests --- .../SonataTranslationExtension.php | 6 +++- tests/App/Provider/DummyUserProvider.php | 32 +++++++++++++++++++ tests/App/config/services.php | 14 ++++++-- .../SonataTranslationExtensionTest.php | 3 +- 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 tests/App/Provider/DummyUserProvider.php diff --git a/src/DependencyInjection/SonataTranslationExtension.php b/src/DependencyInjection/SonataTranslationExtension.php index 18ae265e..3448a20e 100644 --- a/src/DependencyInjection/SonataTranslationExtension.php +++ b/src/DependencyInjection/SonataTranslationExtension.php @@ -160,6 +160,10 @@ private function registerTranslatableListener(ContainerBuilder $container, array ->addMethodCall('setDefaultLocale', ['%locale%']) ->addMethodCall('setTranslatableLocale', ['%locale%']) ->addMethodCall('setTranslationFallback', [false]) - ->addTag('doctrine.event_subscriber'); + ->addTag('doctrine.event_listener', ['event' => 'postLoad']) + ->addTag('doctrine.event_listener', ['event' => 'postPersist']) + ->addTag('doctrine.event_listener', ['event' => 'preFlush']) + ->addTag('doctrine.event_listener', ['event' => 'onFlush']) + ->addTag('doctrine.event_listener', ['event' => 'loadClassMetadata']); } } diff --git a/tests/App/Provider/DummyUserProvider.php b/tests/App/Provider/DummyUserProvider.php new file mode 100644 index 00000000..0aae479b --- /dev/null +++ b/tests/App/Provider/DummyUserProvider.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\TranslationBundle\Tests\App\Provider; + +use Knp\DoctrineBehaviors\Contract\Provider\UserProviderInterface; + +final class DummyUserProvider implements UserProviderInterface +{ + /** + * @return object|string|null + */ + public function provideUser() + { + return null; + } + + public function provideUserEntity(): ?string + { + return null; + } +} diff --git a/tests/App/config/services.php b/tests/App/config/services.php index 798b67e2..de1b3f3a 100644 --- a/tests/App/config/services.php +++ b/tests/App/config/services.php @@ -14,10 +14,12 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; use Gedmo\Translatable\TranslatableListener; +use Knp\DoctrineBehaviors\Provider\UserProvider; use Sonata\TranslationBundle\Tests\App\Admin\GedmoCategoryAdmin; use Sonata\TranslationBundle\Tests\App\Admin\KnpCategoryAdmin; use Sonata\TranslationBundle\Tests\App\Entity\GedmoCategory; use Sonata\TranslationBundle\Tests\App\Entity\KnpCategory; +use Sonata\TranslationBundle\Tests\App\Provider\DummyUserProvider; return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->services() @@ -42,8 +44,16 @@ ]) ->set('app.gedmo.translation_listener', TranslatableListener::class) - ->call('setAnnotationReader', [service('annotation_reader')->ignoreOnInvalid()]) + ->call('setAnnotationReader', [service('annotation_reader')->nullOnInvalid()]) ->call('setDefaultLocale', [param('locale')]) ->call('setTranslationFallback', [false]) - ->tag('doctrine.event_subscriber'); + ->tag('doctrine.event_listener', ['event' => 'postLoad']) + ->tag('doctrine.event_listener', ['event' => 'postPersist']) + ->tag('doctrine.event_listener', ['event' => 'preFlush']) + ->tag('doctrine.event_listener', ['event' => 'onFlush']) + ->tag('doctrine.event_listener', ['event' => 'loadClassMetadata']) + + // Temporary fix to decorate User Provider from KNP (see https://github.com/KnpLabs/DoctrineBehaviors/pull/727) + ->set(DummyUserProvider::class) + ->decorate(UserProvider::class); }; diff --git a/tests/DependencyInjection/SonataTranslationExtensionTest.php b/tests/DependencyInjection/SonataTranslationExtensionTest.php index a5d86aa8..a4f2efae 100644 --- a/tests/DependencyInjection/SonataTranslationExtensionTest.php +++ b/tests/DependencyInjection/SonataTranslationExtensionTest.php @@ -17,6 +17,7 @@ use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; use Sonata\TranslationBundle\DependencyInjection\SonataTranslationExtension; use Sonata\TranslationBundle\Filter\TranslationFieldFilter; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Reference; /** @@ -85,7 +86,7 @@ public function testRegistersTranslatableListenerWhenUsingGedmo(): void $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( 'sonata_translation.listener.translatable', 'setAnnotationReader', - [new Reference('annotation_reader')] + [new Reference('annotation_reader', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)] ); $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( From 8e9bef802ea6c5fce0b675911c26a130ac95ad6a Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sat, 16 Dec 2023 10:40:20 +0100 Subject: [PATCH 10/10] Fix deprecations and SA --- src/Admin/Extension/Gedmo/TranslatableAdminExtension.php | 1 + src/Twig/Extension/SonataTranslationExtension.php | 2 +- tests/App/AppKernel.php | 3 --- tests/Provider/Knplabs/LocaleProviderTest.php | 4 ++-- tests/Traits/DoctrineOrmTestCase.php | 4 +++- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Admin/Extension/Gedmo/TranslatableAdminExtension.php b/src/Admin/Extension/Gedmo/TranslatableAdminExtension.php index adaaaceb..e2b69c47 100644 --- a/src/Admin/Extension/Gedmo/TranslatableAdminExtension.php +++ b/src/Admin/Extension/Gedmo/TranslatableAdminExtension.php @@ -79,6 +79,7 @@ private function setLocale(object $object): void \assert($objectManager instanceof ObjectManager); $configuration = $this->translatableListener->getConfiguration($objectManager, $objectClassName); + /** @psalm-suppress InvalidArrayOffset */ if (!isset($configuration['locale'])) { throw new \LogicException(sprintf( 'There is no locale or language property found on class: "%s"', diff --git a/src/Twig/Extension/SonataTranslationExtension.php b/src/Twig/Extension/SonataTranslationExtension.php index aa63e0d8..67e8096f 100644 --- a/src/Twig/Extension/SonataTranslationExtension.php +++ b/src/Twig/Extension/SonataTranslationExtension.php @@ -64,7 +64,7 @@ public function isTranslatable($object): bool return $this->getTranslatableChecker()->isTranslatable($object); } - public function getLocaleName(string $locale, ?string $displayLocale = null): ?string + public function getLocaleName(string $locale, ?string $displayLocale = null): string { return Locales::getName($locale, $displayLocale); } diff --git a/tests/App/AppKernel.php b/tests/App/AppKernel.php index 25c2c856..61bdee1d 100644 --- a/tests/App/AppKernel.php +++ b/tests/App/AppKernel.php @@ -79,9 +79,6 @@ protected function configureRoutes(RoutingConfigurator $routes): void $routes->import(sprintf('%s/config/routes.yaml', $this->getProjectDir())); } - /** - * @psalm-suppress DeprecatedClass - */ protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { $container->setParameter('app.base_dir', $this->getBaseDir()); diff --git a/tests/Provider/Knplabs/LocaleProviderTest.php b/tests/Provider/Knplabs/LocaleProviderTest.php index b6b210a1..3f96fcdc 100644 --- a/tests/Provider/Knplabs/LocaleProviderTest.php +++ b/tests/Provider/Knplabs/LocaleProviderTest.php @@ -66,12 +66,12 @@ public function __construct(private string $locale) { } - public function provideCurrentLocale(): ?string + public function provideCurrentLocale(): string { return $this->locale; } - public function provideFallbackLocale(): ?string + public function provideFallbackLocale(): string { return $this->locale; } diff --git a/tests/Traits/DoctrineOrmTestCase.php b/tests/Traits/DoctrineOrmTestCase.php index 8fd150da..b8a7d6e7 100644 --- a/tests/Traits/DoctrineOrmTestCase.php +++ b/tests/Traits/DoctrineOrmTestCase.php @@ -80,7 +80,9 @@ final protected function getConfiguration(): Configuration return ORMSetup::createAttributeMetadataConfiguration( [], false, - sys_get_temp_dir().'/sonata-translation-bundle' + sys_get_temp_dir().'/sonata-translation-bundle', + null, + true, ); } }