From 1cdad5a321f71bc0997a516a3c4ea97f9f9a5033 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Fri, 29 Sep 2023 17:20:46 +0200 Subject: [PATCH] Fix --- composer.json | 2 +- .../CategoryAdminControllerTest.php | 46 ++++++++----------- tests/Functional/Admin/CategoryAdminTest.php | 4 +- .../Functional/Admin/CollectionAdminTest.php | 4 +- tests/Functional/Admin/ContextAdminTest.php | 4 +- tests/Functional/Admin/TagAdminTest.php | 4 +- 6 files changed, 29 insertions(+), 35 deletions(-) diff --git a/composer.json b/composer.json index 5c750147..5fbacfc3 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,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/admin-bundle": "^4.14", "sonata-project/block-bundle": "^4.11 || ^5.0", "sonata-project/doctrine-orm-admin-bundle": "^4.0", diff --git a/tests/Controller/CategoryAdminControllerTest.php b/tests/Controller/CategoryAdminControllerTest.php index 193194d3..7e9138cd 100644 --- a/tests/Controller/CategoryAdminControllerTest.php +++ b/tests/Controller/CategoryAdminControllerTest.php @@ -173,7 +173,7 @@ public function testListActionWithoutFilter(): void } /** - * @dataProvider listActionData + * @dataProvider provideListActionCases */ public function testListAction(string|false $context): void { @@ -184,9 +184,7 @@ public function testListAction(string|false $context): void $datagrid = $this->createMock(DatagridInterface::class); - $form = $this->getMockBuilder(Form::class) - ->disableOriginalConstructor() - ->getMock(); + $form = $this->createMock(Form::class); $form->expects(static::once()) ->method('createView') @@ -219,20 +217,18 @@ public function testListAction(string|false $context): void } /** - * @return array + * @return iterable */ - public function listActionData(): array + public function provideListActionCases(): iterable { - return [ - 'context' => ['default'], - 'no context' => [false], - ]; + yield 'context' => ['default']; + yield 'no context' => [false]; } /** - * @dataProvider treeActionData + * @dataProvider provideTreeActionCases * - * @param array $categories + * @param array $categories */ public function testTreeAction(string|false $context, array $categories): void { @@ -292,22 +288,20 @@ public function testTreeAction(string|false $context, array $categories): void } /** - * @return array + * @return iterable}> */ - public function treeActionData(): array + public function provideTreeActionCases(): iterable { - return [ - 'context and no categories' => ['default', []], - 'no context and no categories' => [false, []], - 'context and categories' => ['default', [ - ['First Category', 'other'], - ['Second Category', 'default'], - ]], - 'no context and categories' => [false, [ - ['First Category', 'other'], - ['Second Category', 'default'], - ]], - ]; + yield 'context and no categories' => ['default', []]; + yield 'no context and no categories' => [false, []]; + yield 'context and categories' => ['default', [ + ['First Category', 'other'], + ['Second Category', 'default'], + ]]; + yield 'no context and categories' => [false, [ + ['First Category', 'other'], + ['Second Category', 'default'], + ]]; } /** diff --git a/tests/Functional/Admin/CategoryAdminTest.php b/tests/Functional/Admin/CategoryAdminTest.php index 43863eae..04d4f274 100644 --- a/tests/Functional/Admin/CategoryAdminTest.php +++ b/tests/Functional/Admin/CategoryAdminTest.php @@ -57,7 +57,7 @@ public static function provideCrudUrlsCases(): iterable } /** - * @dataProvider provideFormUrlsCases + * @dataProvider provideFormsUrlsCases * * @param array $parameters * @param array $fieldValues @@ -80,7 +80,7 @@ public function testFormsUrls(string $url, array $parameters, string $button, ar * * @phpstan-return iterable, 2: string, 3?: array}> */ - public static function provideFormUrlsCases(): iterable + public static function provideFormsUrlsCases(): iterable { yield 'Create Category' => ['/admin/tests/app/category/create', [ 'uniqid' => 'category', diff --git a/tests/Functional/Admin/CollectionAdminTest.php b/tests/Functional/Admin/CollectionAdminTest.php index e90809fa..c65e71da 100644 --- a/tests/Functional/Admin/CollectionAdminTest.php +++ b/tests/Functional/Admin/CollectionAdminTest.php @@ -48,7 +48,7 @@ public static function provideCrudUrlsCases(): iterable } /** - * @dataProvider provideFormUrlsCases + * @dataProvider provideFormsUrlsCases * * @param array $parameters * @param array $fieldValues @@ -71,7 +71,7 @@ public function testFormsUrls(string $url, array $parameters, string $button, ar * * @phpstan-return iterable, 2: string, 3?: array}> */ - public static function provideFormUrlsCases(): iterable + public static function provideFormsUrlsCases(): iterable { yield 'Create Collection' => ['/admin/tests/app/collection/create', [ 'uniqid' => 'collection', diff --git a/tests/Functional/Admin/ContextAdminTest.php b/tests/Functional/Admin/ContextAdminTest.php index 2017f3ed..054b41e8 100644 --- a/tests/Functional/Admin/ContextAdminTest.php +++ b/tests/Functional/Admin/ContextAdminTest.php @@ -47,7 +47,7 @@ public static function provideCrudUrlsCases(): iterable } /** - * @dataProvider provideFormUrlsCases + * @dataProvider provideFormsUrlsCases * * @param array $parameters * @param array $fieldValues @@ -70,7 +70,7 @@ public function testFormsUrls(string $url, array $parameters, string $button, ar * * @phpstan-return iterable, 2: string, 3?: array}> */ - public static function provideFormUrlsCases(): iterable + public static function provideFormsUrlsCases(): iterable { yield 'Create Context' => ['/admin/tests/app/context/create', [ 'uniqid' => 'context', diff --git a/tests/Functional/Admin/TagAdminTest.php b/tests/Functional/Admin/TagAdminTest.php index d87c24f2..b427654e 100644 --- a/tests/Functional/Admin/TagAdminTest.php +++ b/tests/Functional/Admin/TagAdminTest.php @@ -48,7 +48,7 @@ public static function provideCrudUrlsCases(): iterable } /** - * @dataProvider provideFormUrlsCases + * @dataProvider provideFormsUrlsCases * * @param array $parameters * @param array $fieldValues @@ -71,7 +71,7 @@ public function testFormsUrls(string $url, array $parameters, string $button, ar * * @phpstan-return iterable, 2: string, 3?: array}> */ - public static function provideFormUrlsCases(): iterable + public static function provideFormsUrlsCases(): iterable { yield 'Create Tag' => ['/admin/tests/app/tag/create', [ 'uniqid' => 'tag',