3030use Symfony \Component \OptionsResolver \Exception \MissingOptionsException ;
3131use Symfony \Component \Validator \Exception \ValidationFailedException ;
3232
33- class CrudTest extends AbstractCrudTest
33+ class CrudTest extends AbstractCrudTestCase
3434{
3535 /**
3636 * @dataProvider getTestCrudWithInvalidSessionNameProvider
@@ -45,7 +45,7 @@ public function testCrudWithInvalidSessionName(mixed $sessionName, string $expec
4545 $ this ->createCrud ($ crudOptions );
4646 }
4747
48- public function getTestCrudWithInvalidSessionNameProvider (): array
48+ public static function getTestCrudWithInvalidSessionNameProvider (): array
4949 {
5050 return [
5151 ['' , InvalidOptionsException::class, '/The option "session_name" with value ".*" is invalid/ ' ],
@@ -118,7 +118,7 @@ public function testAddColumnAlreadyExists(callable $callback): void
118118 $ this ->createCrud ($ crudConfig );
119119 }
120120
121- public function getTestAddColumnAlreadyExistsProvider (): array
121+ public static function getTestAddColumnAlreadyExistsProvider (): array
122122 {
123123 return [
124124 [static function (CrudConfig $ crudConfig ): void {
@@ -249,20 +249,22 @@ public function testGetVirtualColumnNotExists(): void
249249 /**
250250 * @dataProvider getTestQueryBuilderProvider
251251 */
252- public function testQueryBuilder (mixed $ queryBuilder ): void
252+ public function testQueryBuilder (\ Closure $ queryBuilderFactory ): void
253253 {
254+ $ queryBuilder = $ queryBuilderFactory ($ this );
255+
254256 $ crudConfig = $ this ->createValidCrudConfig ()
255257 ->setQueryBuilder ($ queryBuilder );
256258 $ crud = $ this ->createCrud ($ crudConfig );
257259 $ this ->assertSame ($ queryBuilder , $ crud ->getQueryBuilder ());
258260 }
259261
260- public function getTestQueryBuilderProvider (): array
262+ public static function getTestQueryBuilderProvider (): array
261263 {
262264 return [
263- [$ this ->createMock (\Doctrine \ORM \QueryBuilder::class)],
264- [$ this ->createMock (\Doctrine \DBAL \Query \QueryBuilder::class)],
265- [$ this ->createMock (\Ecommit \CrudBundle \Crud \QueryBuilderInterface::class)],
265+ [static fn ( self $ testCase ) => $ testCase ->createMock (\Doctrine \ORM \QueryBuilder::class)],
266+ [static fn ( self $ testCase ) => $ testCase ->createMock (\Doctrine \DBAL \Query \QueryBuilder::class)],
267+ [static fn ( self $ testCase ) => $ testCase ->createMock (\Ecommit \CrudBundle \Crud \QueryBuilderInterface::class)],
266268 ];
267269 }
268270
@@ -771,7 +773,7 @@ public function testRequiredOptions(string $option): void
771773 $ this ->createCrud ($ crudConfig );
772774 }
773775
774- public function getTestRequiredOptionsProvider (): array
776+ public static function getTestRequiredOptionsProvider (): array
775777 {
776778 return [
777779 ['session_name ' ],
@@ -873,7 +875,7 @@ public function testChangeColumnsDisplayedWithBadValue(array $value): void
873875 $ this ->assertSame (['firstName ' ], $ crud ->getSessionValues ()->getDisplayedColumns ());
874876 }
875877
876- public function getTestChangeColumnsDisplayedWithBadValueProvider (): array
878+ public static function getTestChangeColumnsDisplayedWithBadValueProvider (): array
877879 {
878880 return [
879881 [['bad_column ' ]],
@@ -906,7 +908,7 @@ public function testChangeSortWithBadValue(mixed $value): void
906908 $ this ->assertSame ('username ' , $ crud ->getSessionValues ()->getSort ());
907909 }
908910
909- public function getTestChangeSortWithBadValueProvider (): array
911+ public static function getTestChangeSortWithBadValueProvider (): array
910912 {
911913 return [
912914 [null ],
@@ -944,7 +946,7 @@ public function testChangeSortPersonalizedSortWithBadValue(mixed $value): void
944946 $ this ->assertSame ('defaultPersonalizedSort ' , $ crud ->getSessionValues ()->getSort ());
945947 }
946948
947- public function getTestChangeSortPersonalizedSortWithBadValueProvider (): array
949+ public static function getTestChangeSortPersonalizedSortWithBadValueProvider (): array
948950 {
949951 return [
950952 [null ],
@@ -977,7 +979,7 @@ public function testChangeSortDirectionWithBadValue(mixed $value): void
977979 $ this ->assertSame (Crud::DESC , $ crud ->getSessionValues ()->getSortDirection ());
978980 }
979981
980- public function getTestChangeSortDirectionWithBadValueProvider (): array
982+ public static function getTestChangeSortDirectionWithBadValueProvider (): array
981983 {
982984 return [
983985 [null ],
@@ -1002,8 +1004,9 @@ public function testChangeSearchFormData(): void
10021004 /**
10031005 * @dataProvider getTestChangeSearchFormDataWithBadValueProvider
10041006 */
1005- public function testChangeSearchFormDataWithBadValue (? SearcherInterface $ value ): void
1007+ public function testChangeSearchFormDataWithBadValue (\ Closure $ valueFactory ): void
10061008 {
1009+ $ value = $ valueFactory ($ this );
10071010 $ crud = $ this ->createCrud ($ this ->createValidCrudConfig (withSearcher: true ));
10081011
10091012 $ reflectionMethod = (new \ReflectionClass ($ crud ))->getMethod ('changeSearchFormData ' );
@@ -1013,11 +1016,11 @@ public function testChangeSearchFormDataWithBadValue(?SearcherInterface $value):
10131016 $ this ->assertEquals (new UserSearcher (), $ crud ->getSessionValues ()->getSearchFormData ());
10141017 }
10151018
1016- public function getTestChangeSearchFormDataWithBadValueProvider (): array
1019+ public static function getTestChangeSearchFormDataWithBadValueProvider (): array
10171020 {
10181021 return [
1019- [null ],
1020- [$ this ->createMock (SearcherInterface::class)],
1022+ [static fn ( self $ self ) => null ],
1023+ [static fn ( self $ self ) => $ self ->createMock (SearcherInterface::class)],
10211024 ];
10221025 }
10231026
@@ -1031,7 +1034,7 @@ public function testChangeSearchFormDataWithoutSearchForm(): void
10311034 $ this ->assertNull ($ crud ->getSessionValues ()->getSearchFormData ());
10321035 }
10331036
1034- public function getBoolProvider (): array
1037+ public static function getBoolProvider (): array
10351038 {
10361039 return [
10371040 [true ],
0 commit comments