33namespace Kdabrow \ValidationCodes \Tests ;
44
55use Illuminate \Testing \Fluent \AssertableJson ;
6+ use PHPUnit \Framework \Attributes \Test ;
67
78class ApiTest extends TestCase
89{
9- /** @test */
10+ #[Test]
1011 public function response_returns_status_422_validation_error ()
1112 {
1213 $ response = $ this ->json ('POST ' , '/test ' );
1314
1415 $ response ->assertStatus (422 );
1516 }
1617
17- /** @test */
18+ #[Test]
1819 public function error_response_contains_validation_errors_key ()
1920 {
2021 $ response = $ this ->json ('POST ' , '/test ' );
@@ -29,7 +30,7 @@ public function error_response_contains_validation_errors_key()
2930 ]);
3031 }
3132
32- /** @test */
33+ #[Test]
3334 public function error_response_contains_validation_codes_key ()
3435 {
3536 $ response = $ this ->json ('POST ' , '/test ' );
@@ -39,7 +40,7 @@ public function error_response_contains_validation_codes_key()
3940 });
4041 }
4142
42- /** @test */
43+ #[Test]
4344 public function error_response_codes_array_contains_field_with_validation_error_code ()
4445 {
4546 $ response = $ this ->json ('POST ' , '/test ' );
@@ -53,7 +54,7 @@ public function error_response_codes_array_contains_field_with_validation_error_
5354 ]);
5455 }
5556
56- /** @test */
57+ #[Test]
5758 public function response_contains_only_codes_while_configuration_show_only_codes_is_true ()
5859 {
5960 config ()->set ('validation_codes.show_only_codes ' , true );
@@ -69,7 +70,7 @@ public function response_contains_only_codes_while_configuration_show_only_codes
6970 ]);
7071 }
7172
72- /** @test */
73+ #[Test]
7374 public function response_contains_multiple_codes ()
7475 {
7576 $ response = $ this ->json ('POST ' , '/test_with_multiple_errors ' , ["field_1 " => "test " ]);
@@ -83,7 +84,7 @@ public function response_contains_multiple_codes()
8384 ]);
8485 }
8586
86- /** @test */
87+ #[Test]
8788 public function response_contains_multiple_fields ()
8889 {
8990 $ response = $ this ->json ('POST ' , '/test_with_multiple_fields ' , ["field_1 " => "test " ]);
@@ -100,7 +101,7 @@ public function response_contains_multiple_fields()
100101 ]);
101102 }
102103
103- /** @test */
104+ #[Test]
104105 public function response_contains_array_fields ()
105106 {
106107 $ response = $ this ->json ('POST ' , '/test_with_array_fields ' , ["field_1 " => [[]]]);
@@ -117,7 +118,7 @@ public function response_contains_array_fields()
117118 ]);
118119 }
119120
120- /** @test */
121+ #[Test]
121122 public function response_contains_errors_from_custom_validation_rules ()
122123 {
123124 $ response = $ this ->json ('POST ' , '/test_with_custom_validation_rules ' , ["field_1 " => 1 ]);
@@ -131,7 +132,7 @@ public function response_contains_errors_from_custom_validation_rules()
131132 ]);
132133 }
133134
134- /** @test */
135+ #[Test]
135136 public function response_contains_fallback_error_when_custom_rules_do_not_contain_the_code ()
136137 {
137138 $ response = $ this ->json ('POST ' , '/test_with_custom_validation_rules_without_code ' , ["field_1 " => 1 ]);
@@ -145,7 +146,7 @@ public function response_contains_fallback_error_when_custom_rules_do_not_contai
145146 ]);
146147 }
147148
148- /** @test */
149+ #[Test]
149150 public function response_returns_fallback_error_when_validation_rule_translation_do_not_exists ()
150151 {
151152 $ response = $ this ->json ('POST ' , '/test_with_not_existing_validation_code ' , ["field_1 " => 1 ]);
@@ -159,7 +160,7 @@ public function response_returns_fallback_error_when_validation_rule_translation
159160 ]);
160161 }
161162
162- /** @test */
163+ #[Test]
163164 public function response_returns_the_code_when_validation_rule_translation_extends_validator ()
164165 {
165166 $ response = $ this ->json ('POST ' , '/test_with_existing_validation_code ' , ["field_1 " => 1 ]);
0 commit comments