1414
1515use BitExpert \SyliusForceCustomerLoginPlugin \Events \ForceLoginRequestEvent ;
1616use BitExpert \SyliusForceCustomerLoginPlugin \Http \DefaultRouteChecker ;
17+ use PHPUnit \Framework \Attributes \DataProvider ;
18+ use PHPUnit \Framework \Attributes \Test ;
1719use Symfony \Bundle \SecurityBundle \Security ;
1820use Symfony \Component \HttpFoundation \Request ;
1921use Symfony \Component \HttpKernel \Event \RequestEvent ;
@@ -51,9 +53,7 @@ protected function setUp(): void
5153 );
5254 }
5355
54- /**
55- * @test
56- */
56+ #[Test]
5757 public function requestEventIsIgnoredForSubRequest (): void
5858 {
5959 $ this ->eventMock ->method ('isMainRequest ' )->willReturn (false );
@@ -63,9 +63,7 @@ public function requestEventIsIgnoredForSubRequest(): void
6363 $ this ->forceLoginRequestEvent ->onKernelRequest ($ this ->eventMock );
6464 }
6565
66- /**
67- * @test
68- */
66+ #[Test]
6967 public function requestEventIsIgnoredForLoggedInUser (): void
7068 {
7169 $ user = $ this ->createMock (UserInterface::class);
@@ -79,9 +77,8 @@ public function requestEventIsIgnoredForLoggedInUser(): void
7977 $ this ->forceLoginRequestEvent ->onKernelRequest ($ this ->eventMock );
8078 }
8179
82- /**
83- * @dataProvider whitelistedUrls
84- */
80+ #[Test]
81+ #[DataProvider('whitelistedUrls ' )]
8582 public function whitelistedUrlsAlwaysGrantAccess (string $ url ): void
8683 {
8784 $ request = Request::create ($ url );
@@ -95,9 +92,8 @@ public function whitelistedUrlsAlwaysGrantAccess(string $url): void
9592 $ this ->assertTrue (true );
9693 }
9794
98- /**
99- * @dataProvider whitelistedUrlsWithLocale
100- */
95+ #[Test]
96+ #[DataProvider('whitelistedUrlsWithLocale ' )]
10197 public function whitelistedUrlsWithLocaleAlwaysGrantAccess (string $ url ): void
10298 {
10399 $ request = Request::create ($ url );
@@ -111,9 +107,7 @@ public function whitelistedUrlsWithLocaleAlwaysGrantAccess(string $url): void
111107 $ this ->assertTrue (true );
112108 }
113109
114- /**
115- * @test
116- */
110+ #[Test]
117111 public function urlWithNoAccessGrantedThrowsAccessDeniedException (): void
118112 {
119113 $ this ->expectException (AccessDeniedException::class);
@@ -129,9 +123,7 @@ public function urlWithNoAccessGrantedThrowsAccessDeniedException(): void
129123 $ this ->forceLoginRequestEvent ->onKernelRequest ($ this ->eventMock );
130124 }
131125
132- /**
133- * @test
134- */
126+ #[Test]
135127 public function accessGrantedSucceeds (): void
136128 {
137129 $ url = '/taxons/caps/with-pompons ' ;
@@ -146,11 +138,11 @@ public function accessGrantedSucceeds(): void
146138 $ this ->assertTrue (true );
147139 }
148140
149- public function whitelistedUrls (): array
141+ public static function whitelistedUrls (): array
150142 {
151143 return [
152144 ['/_wdt ' ],
153- ['/profiler ' ],
145+ ['/_profiler ' ],
154146 ['/admin ' ],
155147 ['/login ' ],
156148 ['/register ' ],
@@ -160,7 +152,7 @@ public function whitelistedUrls(): array
160152 ];
161153 }
162154
163- public function whitelistedUrlsWithLocale (): array
155+ public static function whitelistedUrlsWithLocale (): array
164156 {
165157 return [
166158 ['/en ' ],
0 commit comments