33namespace Spatie \Permission \Tests ;
44
55use Illuminate \Support \Facades \Artisan ;
6+ use PHPUnit \Framework \Attributes \Test ;
67use Spatie \Permission \Contracts \Role ;
78
89class BladeTest extends TestCase
@@ -21,6 +22,7 @@ protected function setUp(): void
2122 }
2223
2324 /** @test */
25+ #[Test]
2426 public function all_blade_directives_will_evaluate_false_when_there_is_nobody_logged_in ()
2527 {
2628 $ permission = 'edit-articles ' ;
@@ -40,6 +42,7 @@ public function all_blade_directives_will_evaluate_false_when_there_is_nobody_lo
4042 }
4143
4244 /** @test */
45+ #[Test]
4346 public function all_blade_directives_will_evaluate_false_when_somebody_without_roles_or_permissions_is_logged_in ()
4447 {
4548 $ permission = 'edit-articles ' ;
@@ -59,6 +62,7 @@ public function all_blade_directives_will_evaluate_false_when_somebody_without_r
5962 }
6063
6164 /** @test */
65+ #[Test]
6266 public function all_blade_directives_will_evaluate_false_when_somebody_with_another_guard_is_logged_in ()
6367 {
6468 $ permission = 'edit-articles ' ;
@@ -79,6 +83,7 @@ public function all_blade_directives_will_evaluate_false_when_somebody_with_anot
7983 }
8084
8185 /** @test */
86+ #[Test]
8287 public function the_can_directive_can_accept_a_guard_name ()
8388 {
8489 $ user = $ this ->getWriter ();
@@ -109,6 +114,7 @@ public function the_can_directive_can_accept_a_guard_name()
109114 }
110115
111116 /** @test */
117+ #[Test]
112118 public function the_can_directive_will_evaluate_true_when_the_logged_in_user_has_the_permission ()
113119 {
114120 $ user = $ this ->getWriter ();
@@ -121,6 +127,7 @@ public function the_can_directive_will_evaluate_true_when_the_logged_in_user_has
121127 }
122128
123129 /** @test */
130+ #[Test]
124131 public function the_haspermission_directive_will_evaluate_true_when_the_logged_in_user_has_the_permission ()
125132 {
126133 $ user = $ this ->getWriter ();
@@ -145,6 +152,7 @@ public function the_haspermission_directive_will_evaluate_true_when_the_logged_i
145152 }
146153
147154 /** @test */
155+ #[Test]
148156 public function the_role_directive_will_evaluate_true_when_the_logged_in_user_has_the_role ()
149157 {
150158 auth ()->setUser ($ this ->getWriter ());
@@ -153,6 +161,7 @@ public function the_role_directive_will_evaluate_true_when_the_logged_in_user_ha
153161 }
154162
155163 /** @test */
164+ #[Test]
156165 public function the_elserole_directive_will_evaluate_true_when_the_logged_in_user_has_the_role ()
157166 {
158167 auth ()->setUser ($ this ->getMember ());
@@ -161,6 +170,7 @@ public function the_elserole_directive_will_evaluate_true_when_the_logged_in_use
161170 }
162171
163172 /** @test */
173+ #[Test]
164174 public function the_role_directive_will_evaluate_true_when_the_logged_in_user_has_the_role_for_the_given_guard ()
165175 {
166176 auth ('admin ' )->setUser ($ this ->getSuperAdmin ());
@@ -169,6 +179,7 @@ public function the_role_directive_will_evaluate_true_when_the_logged_in_user_ha
169179 }
170180
171181 /** @test */
182+ #[Test]
172183 public function the_hasrole_directive_will_evaluate_true_when_the_logged_in_user_has_the_role ()
173184 {
174185 auth ()->setUser ($ this ->getWriter ());
@@ -177,6 +188,7 @@ public function the_hasrole_directive_will_evaluate_true_when_the_logged_in_user
177188 }
178189
179190 /** @test */
191+ #[Test]
180192 public function the_hasrole_directive_will_evaluate_true_when_the_logged_in_user_has_the_role_for_the_given_guard ()
181193 {
182194 auth ('admin ' )->setUser ($ this ->getSuperAdmin ());
@@ -185,6 +197,7 @@ public function the_hasrole_directive_will_evaluate_true_when_the_logged_in_user
185197 }
186198
187199 /** @test */
200+ #[Test]
188201 public function the_unlessrole_directive_will_evaluate_true_when_the_logged_in_user_does_not_have_the_role ()
189202 {
190203 auth ()->setUser ($ this ->getWriter ());
@@ -193,6 +206,7 @@ public function the_unlessrole_directive_will_evaluate_true_when_the_logged_in_u
193206 }
194207
195208 /** @test */
209+ #[Test]
196210 public function the_unlessrole_directive_will_evaluate_true_when_the_logged_in_user_does_not_have_the_role_for_the_given_guard ()
197211 {
198212 auth ('admin ' )->setUser ($ this ->getSuperAdmin ());
@@ -202,6 +216,7 @@ public function the_unlessrole_directive_will_evaluate_true_when_the_logged_in_u
202216 }
203217
204218 /** @test */
219+ #[Test]
205220 public function the_hasanyrole_directive_will_evaluate_false_when_the_logged_in_user_does_not_have_any_of_the_required_roles ()
206221 {
207222 $ roles = ['writer ' , 'intern ' ];
@@ -213,6 +228,7 @@ public function the_hasanyrole_directive_will_evaluate_false_when_the_logged_in_
213228 }
214229
215230 /** @test */
231+ #[Test]
216232 public function the_hasanyrole_directive_will_evaluate_true_when_the_logged_in_user_does_have_some_of_the_required_roles ()
217233 {
218234 $ roles = ['member ' , 'writer ' , 'intern ' ];
@@ -224,6 +240,7 @@ public function the_hasanyrole_directive_will_evaluate_true_when_the_logged_in_u
224240 }
225241
226242 /** @test */
243+ #[Test]
227244 public function the_hasanyrole_directive_will_evaluate_true_when_the_logged_in_user_does_have_some_of_the_required_roles_for_the_given_guard ()
228245 {
229246 $ roles = ['super-admin ' , 'moderator ' ];
@@ -235,6 +252,7 @@ public function the_hasanyrole_directive_will_evaluate_true_when_the_logged_in_u
235252 }
236253
237254 /** @test */
255+ #[Test]
238256 public function the_hasanyrole_directive_will_evaluate_true_when_the_logged_in_user_does_have_some_of_the_required_roles_in_pipe ()
239257 {
240258 $ guard = 'admin ' ;
@@ -245,6 +263,7 @@ public function the_hasanyrole_directive_will_evaluate_true_when_the_logged_in_u
245263 }
246264
247265 /** @test */
266+ #[Test]
248267 public function the_hasanyrole_directive_will_evaluate_false_when_the_logged_in_user_doesnt_have_some_of_the_required_roles_in_pipe ()
249268 {
250269 $ guard = '' ;
@@ -255,6 +274,7 @@ public function the_hasanyrole_directive_will_evaluate_false_when_the_logged_in_
255274 }
256275
257276 /** @test */
277+ #[Test]
258278 public function the_hasallroles_directive_will_evaluate_false_when_the_logged_in_user_does_not_have_all_required_roles ()
259279 {
260280 $ roles = ['member ' , 'writer ' ];
@@ -266,6 +286,7 @@ public function the_hasallroles_directive_will_evaluate_false_when_the_logged_in
266286 }
267287
268288 /** @test */
289+ #[Test]
269290 public function the_hasallroles_directive_will_evaluate_true_when_the_logged_in_user_does_have_all_required_roles ()
270291 {
271292 $ roles = ['member ' , 'writer ' ];
@@ -281,6 +302,7 @@ public function the_hasallroles_directive_will_evaluate_true_when_the_logged_in_
281302 }
282303
283304 /** @test */
305+ #[Test]
284306 public function the_hasallroles_directive_will_evaluate_true_when_the_logged_in_user_does_have_all_required_roles_for_the_given_guard ()
285307 {
286308 $ roles = ['super-admin ' , 'moderator ' ];
@@ -296,6 +318,7 @@ public function the_hasallroles_directive_will_evaluate_true_when_the_logged_in_
296318 }
297319
298320 /** @test */
321+ #[Test]
299322 public function the_hasallroles_directive_will_evaluate_true_when_the_logged_in_user_does_have_all_required_roles_in_pipe ()
300323 {
301324 $ guard = 'admin ' ;
@@ -310,6 +333,7 @@ public function the_hasallroles_directive_will_evaluate_true_when_the_logged_in_
310333 }
311334
312335 /** @test */
336+ #[Test]
313337 public function the_hasallroles_directive_will_evaluate_false_when_the_logged_in_user_doesnt_have_all_required_roles_in_pipe ()
314338 {
315339 $ guard = '' ;
@@ -323,6 +347,7 @@ public function the_hasallroles_directive_will_evaluate_false_when_the_logged_in
323347 }
324348
325349 /** @test */
350+ #[Test]
326351 public function the_hasallroles_directive_will_evaluate_true_when_the_logged_in_user_does_have_all_required_roles_in_array ()
327352 {
328353 $ guard = 'admin ' ;
@@ -337,6 +362,7 @@ public function the_hasallroles_directive_will_evaluate_true_when_the_logged_in_
337362 }
338363
339364 /** @test */
365+ #[Test]
340366 public function the_hasallroles_directive_will_evaluate_false_when_the_logged_in_user_doesnt_have_all_required_roles_in_array ()
341367 {
342368 $ guard = '' ;
0 commit comments