22
33namespace Rareloop \Psr7ServerRequestExtension \Test ;
44
5+ use PHPUnit \Framework \Attributes \Test ;
56use PHPUnit \Framework \TestCase ;
67use Rareloop \Psr7ServerRequestExtension \Test \TestDiactorosServerRequest as ServerRequest ;
78
89class Psr7ServerRequestExtensionTest extends TestCase
910{
10- /** @test */
11+ #[Test]
1112 public function can_get_path ()
1213 {
1314 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' );
1415
1516 $ this ->assertSame ('/test/123 ' , $ request ->path ());
1617 }
1718
18- /** @test */
19+ #[Test]
1920 public function can_get_url_without_query_string ()
2021 {
2122 $ request = new ServerRequest ([], [], 'https://test.com/test/123?foo=bar ' , 'GET ' );
2223
2324 $ this ->assertSame ('https://test.com/test/123 ' , $ request ->url ());
2425 }
2526
26- /** @test */
27+ #[Test]
2728 public function can_get_url_with_query_string ()
2829 {
2930 $ request = new ServerRequest ([], [], 'https://test.com/test/123?foo=bar ' , 'GET ' );
3031
3132 $ this ->assertSame ('https://test.com/test/123?foo=bar ' , $ request ->fullUrl ());
3233 }
3334
34- /** @test */
35+ #[Test]
3536 public function no_trailing_question_mark_is_added_when_no_query_params_are_present ()
3637 {
3738 $ request = new ServerRequest ([], [], 'https://test.com/test/123 ' , 'GET ' );
3839
3940 $ this ->assertSame ('https://test.com/test/123 ' , $ request ->fullUrl ());
4041 }
4142
42- /** @test */
43+ #[Test]
4344 public function can_check_method ()
4445 {
4546 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' );
@@ -50,7 +51,7 @@ public function can_check_method()
5051 $ this ->assertFalse ($ request ->isMethod ('POST ' ));
5152 }
5253
53- /** @test */
54+ #[Test]
5455 public function can_get_all_input ()
5556 {
5657 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' , 'php://input ' , [], [], ['foo ' => 'bar ' ], ['baz ' => 'qux ' ]);
@@ -61,7 +62,7 @@ public function can_get_all_input()
6162 $ this ->assertSame ('qux ' , $ input ['baz ' ]);
6263 }
6364
64- /** @test */
65+ #[Test]
6566 public function can_get_specific_input_with_key ()
6667 {
6768 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' , 'php://input ' , [], [], ['foo ' => 'bar ' ], ['baz ' => 'qux ' ]);
@@ -70,15 +71,15 @@ public function can_get_specific_input_with_key()
7071 $ this ->assertSame ('qux ' , $ request ->input ('baz ' ));
7172 }
7273
73- /** @test */
74+ #[Test]
7475 public function can_get_default_when_key_is_not_found_in_input ()
7576 {
7677 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' );
7778
7879 $ this ->assertSame ('bar ' , $ request ->input ('foo ' , 'bar ' ));
7980 }
8081
81- /** @test */
82+ #[Test]
8283 public function can_check_if_input_has_a_specific_key ()
8384 {
8485 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' , 'php://input ' , [], [], ['foo ' => 'bar ' ]);
@@ -87,15 +88,15 @@ public function can_check_if_input_has_a_specific_key()
8788 $ this ->assertFalse ($ request ->has ('baz ' ));
8889 }
8990
90- /** @test */
91+ #[Test]
9192 public function can_check_if_input_has_collection_of_keys ()
9293 {
9394 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' , 'php://input ' , [], [], ['foo ' => 'bar ' ], ['baz ' => 'qux ' ]);
9495
9596 $ this ->assertTrue ($ request ->has (['foo ' , 'baz ' ]));
9697 }
9798
98- /** @test */
99+ #[Test]
99100 public function can_get_all_query ()
100101 {
101102 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' , 'php://input ' , [], [], ['foo ' => 'bar ' ], ['baz ' => 'qux ' ]);
@@ -106,23 +107,23 @@ public function can_get_all_query()
106107 $ this ->assertFalse (isset ($ input ['baz ' ]));
107108 }
108109
109- /** @test */
110+ #[Test]
110111 public function can_get_specific_query_with_key ()
111112 {
112113 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' , 'php://input ' , [], [], ['foo ' => 'bar ' ], ['baz ' => 'qux ' ]);
113114
114115 $ this ->assertSame ('bar ' , $ request ->query ('foo ' ));
115116 }
116117
117- /** @test */
118+ #[Test]
118119 public function can_get_default_when_key_is_not_found_in_query ()
119120 {
120121 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' );
121122
122123 $ this ->assertSame ('bar ' , $ request ->query ('foo ' , 'bar ' ));
123124 }
124125
125- /** @test */
126+ #[Test]
126127 public function can_get_all_post ()
127128 {
128129 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' , 'php://input ' , [], [], ['foo ' => 'bar ' ], ['baz ' => 'qux ' ]);
@@ -133,15 +134,15 @@ public function can_get_all_post()
133134 $ this ->assertFalse (isset ($ input ['foo ' ]));
134135 }
135136
136- /** @test */
137+ #[Test]
137138 public function can_get_specific_post_with_key ()
138139 {
139140 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' , 'php://input ' , [], [], ['foo ' => 'bar ' ], ['baz ' => 'qux ' ]);
140141
141142 $ this ->assertSame ('qux ' , $ request ->post ('baz ' ));
142143 }
143144
144- /** @test */
145+ #[Test]
145146 public function can_get_default_when_key_is_not_found_in_post ()
146147 {
147148 $ request = new ServerRequest ([], [], '/test/123 ' , 'GET ' );
0 commit comments