13
13
14
14
use App \Command \AddUserCommand ;
15
15
use App \Repository \UserRepository ;
16
+ use PHPUnit \Framework \Attributes \DataProvider ;
16
17
use Symfony \Component \PasswordHasher \Hasher \UserPasswordHasherInterface ;
17
18
18
- final class AddUserCommandTest extends AbstractCommandTest
19
+ final class AddUserCommandTest extends AbstractCommandTestCase
19
20
{
20
21
/**
21
22
* @var string[]
@@ -35,11 +36,10 @@ protected function setUp(): void
35
36
}
36
37
37
38
/**
38
- * @dataProvider isAdminDataProvider
39
- *
40
39
* This test provides all the arguments required by the command, so the
41
40
* command runs non-interactively and it won't ask for any argument.
42
41
*/
42
+ #[DataProvider('isAdminDataProvider ' )]
43
43
public function testCreateUserNonInteractive (bool $ isAdmin ): void
44
44
{
45
45
$ input = $ this ->userData ;
@@ -52,13 +52,13 @@ public function testCreateUserNonInteractive(bool $isAdmin): void
52
52
}
53
53
54
54
/**
55
- * @dataProvider isAdminDataProvider
56
- *
57
55
* This test doesn't provide all the arguments required by the command, so
58
56
* the command runs interactively and it will ask for the value of the missing
59
57
* 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
61
60
*/
61
+ #[DataProvider('isAdminDataProvider ' )]
62
62
public function testCreateUserInteractive (bool $ isAdmin ): void
63
63
{
64
64
$ this ->executeCommand (
@@ -76,7 +76,7 @@ public function testCreateUserInteractive(bool $isAdmin): void
76
76
* This is used to execute the same test twice: first for normal users
77
77
* (isAdmin = false) and then for admin users (isAdmin = true).
78
78
*/
79
- public function isAdminDataProvider (): \Generator
79
+ public static function isAdminDataProvider (): \Generator
80
80
{
81
81
yield [false ];
82
82
yield [true ];
0 commit comments