Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored and github-actions[bot] committed Sep 29, 2023
1 parent 4697b6e commit 1cdad5a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 35 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
46 changes: 20 additions & 26 deletions tests/Controller/CategoryAdminControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function testListActionWithoutFilter(): void
}

/**
* @dataProvider listActionData
* @dataProvider provideListActionCases
*/
public function testListAction(string|false $context): void
{
Expand All @@ -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')
Expand Down Expand Up @@ -219,20 +217,18 @@ public function testListAction(string|false $context): void
}

/**
* @return array<string, mixed>
* @return iterable<string, array{string|false}>
*/
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<string, string> $categories
* @param array<array{string, string}> $categories
*/
public function testTreeAction(string|false $context, array $categories): void
{
Expand Down Expand Up @@ -292,22 +288,20 @@ public function testTreeAction(string|false $context, array $categories): void
}

/**
* @return array<string, mixed>
* @return iterable<string, array{string|false, array<array{string, string}>}>
*/
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'],
]];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Admin/CategoryAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function provideCrudUrlsCases(): iterable
}

/**
* @dataProvider provideFormUrlsCases
* @dataProvider provideFormsUrlsCases
*
* @param array<string, mixed> $parameters
* @param array<string, mixed> $fieldValues
Expand All @@ -80,7 +80,7 @@ public function testFormsUrls(string $url, array $parameters, string $button, ar
*
* @phpstan-return iterable<array{0: string, 1: array<string, mixed>, 2: string, 3?: array<string, mixed>}>
*/
public static function provideFormUrlsCases(): iterable
public static function provideFormsUrlsCases(): iterable
{
yield 'Create Category' => ['/admin/tests/app/category/create', [
'uniqid' => 'category',
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Admin/CollectionAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function provideCrudUrlsCases(): iterable
}

/**
* @dataProvider provideFormUrlsCases
* @dataProvider provideFormsUrlsCases
*
* @param array<string, mixed> $parameters
* @param array<string, mixed> $fieldValues
Expand All @@ -71,7 +71,7 @@ public function testFormsUrls(string $url, array $parameters, string $button, ar
*
* @phpstan-return iterable<array{0: string, 1: array<string, mixed>, 2: string, 3?: array<string, mixed>}>
*/
public static function provideFormUrlsCases(): iterable
public static function provideFormsUrlsCases(): iterable
{
yield 'Create Collection' => ['/admin/tests/app/collection/create', [
'uniqid' => 'collection',
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Admin/ContextAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function provideCrudUrlsCases(): iterable
}

/**
* @dataProvider provideFormUrlsCases
* @dataProvider provideFormsUrlsCases
*
* @param array<string, mixed> $parameters
* @param array<string, mixed> $fieldValues
Expand All @@ -70,7 +70,7 @@ public function testFormsUrls(string $url, array $parameters, string $button, ar
*
* @phpstan-return iterable<array{0: string, 1: array<string, mixed>, 2: string, 3?: array<string, mixed>}>
*/
public static function provideFormUrlsCases(): iterable
public static function provideFormsUrlsCases(): iterable
{
yield 'Create Context' => ['/admin/tests/app/context/create', [
'uniqid' => 'context',
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Admin/TagAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function provideCrudUrlsCases(): iterable
}

/**
* @dataProvider provideFormUrlsCases
* @dataProvider provideFormsUrlsCases
*
* @param array<string, mixed> $parameters
* @param array<string, mixed> $fieldValues
Expand All @@ -71,7 +71,7 @@ public function testFormsUrls(string $url, array $parameters, string $button, ar
*
* @phpstan-return iterable<array{0: string, 1: array<string, mixed>, 2: string, 3?: array<string, mixed>}>
*/
public static function provideFormUrlsCases(): iterable
public static function provideFormsUrlsCases(): iterable
{
yield 'Create Tag' => ['/admin/tests/app/tag/create', [
'uniqid' => 'tag',
Expand Down

0 comments on commit 1cdad5a

Please sign in to comment.