1313
1414use App \Command \AddUserCommand ;
1515use App \Repository \UserRepository ;
16+ use PHPUnit \Framework \Attributes \DataProvider ;
1617use Symfony \Component \PasswordHasher \Hasher \UserPasswordHasherInterface ;
1718
18- final class AddUserCommandTest extends AbstractCommandTest
19+ final class AddUserCommandTest extends AbstractCommandTestCase
1920{
2021 /**
2122 * @var string[]
@@ -35,11 +36,10 @@ protected function setUp(): void
3536 }
3637
3738 /**
38- * @dataProvider isAdminDataProvider
39- *
4039 * This test provides all the arguments required by the command, so the
4140 * command runs non-interactively and it won't ask for any argument.
4241 */
42+ #[DataProvider('isAdminDataProvider ' )]
4343 public function testCreateUserNonInteractive (bool $ isAdmin ): void
4444 {
4545 $ input = $ this ->userData ;
@@ -52,13 +52,13 @@ public function testCreateUserNonInteractive(bool $isAdmin): void
5252 }
5353
5454 /**
55- * @dataProvider isAdminDataProvider
56- *
5755 * This test doesn't provide all the arguments required by the command, so
5856 * the command runs interactively and it will ask for the value of the missing
5957 * arguments.
60- * See https://symfony.com/doc/current/components/console/helpers/questionhelper.html#testing-a-command-that-expects-input
58+ *
59+ * @see https://symfony.com/doc/current/components/console/helpers/questionhelper.html#testing-a-command-that-expects-input
6160 */
61+ #[DataProvider('isAdminDataProvider ' )]
6262 public function testCreateUserInteractive (bool $ isAdmin ): void
6363 {
6464 $ this ->executeCommand (
@@ -76,7 +76,7 @@ public function testCreateUserInteractive(bool $isAdmin): void
7676 * This is used to execute the same test twice: first for normal users
7777 * (isAdmin = false) and then for admin users (isAdmin = true).
7878 */
79- public function isAdminDataProvider (): \Generator
79+ public static function isAdminDataProvider (): \Generator
8080 {
8181 yield [false ];
8282 yield [true ];
0 commit comments