1313
1414use App \Entity \Post ;
1515use Doctrine \Bundle \DoctrineBundle \Registry ;
16+ use PHPUnit \Framework \Attributes \DataProvider ;
1617use Symfony \Bundle \FrameworkBundle \Test \WebTestCase ;
1718use Symfony \Component \HttpFoundation \Response ;
1819
@@ -32,9 +33,8 @@ final class DefaultControllerTest extends WebTestCase
3233 * PHPUnit's data providers allow to execute the same tests repeated times
3334 * using a different set of data each time.
3435 * See https://symfony.com/doc/current/testing.html#testing-against-different-sets-of-data.
35- *
36- * @dataProvider getPublicUrls
3736 */
37+ #[DataProvider('getPublicUrls ' )]
3838 public function testPublicUrls (string $ url ): void
3939 {
4040 $ client = static ::createClient ();
@@ -69,9 +69,8 @@ public function testPublicBlogPost(): void
6969 * The application contains a lot of secure URLs which shouldn't be
7070 * publicly accessible. This tests ensures that whenever a user tries to
7171 * access one of those pages, a redirection to the login form is performed.
72- *
73- * @dataProvider getSecureUrls
7472 */
73+ #[DataProvider('getSecureUrls ' )]
7574 public function testSecureUrls (string $ url ): void
7675 {
7776 $ client = static ::createClient ();
@@ -84,14 +83,14 @@ public function testSecureUrls(string $url): void
8483 );
8584 }
8685
87- public function getPublicUrls (): \Generator
86+ public static function getPublicUrls (): \Generator
8887 {
8988 yield ['/ ' ];
9089 yield ['/en/blog/ ' ];
9190 yield ['/en/login ' ];
9291 }
9392
94- public function getSecureUrls (): \Generator
93+ public static function getSecureUrls (): \Generator
9594 {
9695 yield ['/en/admin/post/ ' ];
9796 yield ['/en/admin/post/new ' ];
0 commit comments