1313use Phpro \ApiProblem \Http \HttpApiProblem ;
1414use Phpro \ApiProblemBundle \EventListener \JsonApiProblemExceptionListener ;
1515use Phpro \ApiProblemBundle \Transformer \ExceptionTransformerInterface ;
16+ use PHPUnit \Framework \Attributes \CoversClass ;
17+ use PHPUnit \Framework \Attributes \Test ;
1618use PHPUnit \Framework \TestCase ;
1719use Prophecy \Argument ;
1820use Prophecy \PhpUnit \ProphecyTrait ;
2224use Symfony \Component \HttpKernel \Event \ExceptionEvent ;
2325use Symfony \Component \HttpKernel \HttpKernelInterface ;
2426
25- /** @covers \Phpro\ApiProblemBundle\EventListener\ JsonApiProblemExceptionListener */
27+ #[CoversClass( JsonApiProblemExceptionListener::class)]
2628class JsonApiProblemExceptionListenerTest extends TestCase
2729{
2830 use ProphecyTrait;
@@ -38,7 +40,7 @@ protected function setUp(): void
3840 $ this ->exceptionTransformer ->accepts (Argument::any ())->willReturn (false );
3941 }
4042
41- /** @test */
43+ #[Test]
4244 public function it_does_nothing_on_non_json_requests (): void
4345 {
4446 $ listener = new JsonApiProblemExceptionListener ($ this ->exceptionTransformer ->reveal (), false );
@@ -53,7 +55,7 @@ public function it_does_nothing_on_non_json_requests(): void
5355 $ this ->assertNull ($ event ->getResponse ());
5456 }
5557
56- /** @test */
58+ #[Test]
5759 public function it_runs_on_json_route_formats (): void
5860 {
5961 $ listener = new JsonApiProblemExceptionListener ($ this ->exceptionTransformer ->reveal (), false );
@@ -69,7 +71,7 @@ public function it_runs_on_json_route_formats(): void
6971 $ this ->assertApiProblemWithResponseBody ($ event , 500 , $ this ->parseDataForException ($ exception ));
7072 }
7173
72- /** @test */
74+ #[Test]
7375 public function it_runs_on_json_content_types (): void
7476 {
7577 $ listener = new JsonApiProblemExceptionListener ($ this ->exceptionTransformer ->reveal (), false );
@@ -84,7 +86,7 @@ public function it_runs_on_json_content_types(): void
8486 $ this ->assertApiProblemWithResponseBody ($ event , 500 , $ this ->parseDataForException ($ exception ));
8587 }
8688
87- /** @test */
89+ #[Test]
8890 public function it_runs_on_json_accept_header (): void
8991 {
9092 $ listener = new JsonApiProblemExceptionListener ($ this ->exceptionTransformer ->reveal (), false );
@@ -99,7 +101,7 @@ public function it_runs_on_json_accept_header(): void
99101 $ this ->assertApiProblemWithResponseBody ($ event , 500 , $ this ->parseDataForException ($ exception ));
100102 }
101103
102- /** @test */
104+ #[Test]
103105 public function it_parses_an_api_problem_response (): void
104106 {
105107 $ listener = new JsonApiProblemExceptionListener ($ this ->exceptionTransformer ->reveal (), false );
@@ -114,7 +116,7 @@ public function it_parses_an_api_problem_response(): void
114116 $ this ->assertApiProblemWithResponseBody ($ event , 500 , $ this ->parseDataForException ($ exception ));
115117 }
116118
117- /** @test */
119+ #[Test]
118120 public function it_uses_an_exception_transformer (): void
119121 {
120122 $ listener = new JsonApiProblemExceptionListener ($ this ->exceptionTransformer ->reveal (), false );
@@ -134,7 +136,7 @@ public function it_uses_an_exception_transformer(): void
134136 $ this ->assertApiProblemWithResponseBody ($ event , 400 , []);
135137 }
136138
137- /** @test */
139+ #[Test]
138140 public function it_returns_the_status_code_from_the_api_problem (): void
139141 {
140142 $ listener = new JsonApiProblemExceptionListener ($ this ->exceptionTransformer ->reveal (), false );
@@ -154,7 +156,7 @@ public function it_returns_the_status_code_from_the_api_problem(): void
154156 $ this ->assertApiProblemWithResponseBody ($ event , 123 , ['status ' => 123 ]);
155157 }
156158
157- /** @test */
159+ #[Test]
158160 public function it_parses_a_debuggable_api_problem_response (): void
159161 {
160162 $ listener = new JsonApiProblemExceptionListener ($ this ->exceptionTransformer ->reveal (), true );
0 commit comments