@@ -22,7 +22,7 @@ protected function setUp(): void
2222 public function testGetRequest (): void
2323 {
2424 $ response = $ this ->adapter ->send (
25- url: 'localhost :8000 ' ,
25+ url: '127.0.0.1 :8000 ' ,
2626 method: 'GET ' ,
2727 body: null ,
2828 headers: [],
@@ -38,6 +38,7 @@ public function testGetRequest(): void
3838 $ this ->assertInstanceOf (Response::class, $ response );
3939 $ this ->assertSame (200 , $ response ->getStatusCode ());
4040 $ data = $ response ->json ();
41+ $ this ->assertIsArray ($ data );
4142 $ this ->assertSame ('GET ' , $ data ['method ' ]);
4243 }
4344
@@ -48,7 +49,7 @@ public function testPostWithJsonBody(): void
4849 {
4950 $ body = json_encode (['name ' => 'John Doe ' , 'age ' => 30 ]);
5051 $ response = $ this ->adapter ->send (
51- url: 'localhost :8000 ' ,
52+ url: '127.0.0.1 :8000 ' ,
5253 method: 'POST ' ,
5354 body: $ body ,
5455 headers: ['content-type ' => 'application/json ' ],
@@ -64,6 +65,7 @@ public function testPostWithJsonBody(): void
6465 $ this ->assertInstanceOf (Response::class, $ response );
6566 $ this ->assertSame (200 , $ response ->getStatusCode ());
6667 $ data = $ response ->json ();
68+ $ this ->assertIsArray ($ data );
6769 $ this ->assertSame ('POST ' , $ data ['method ' ]);
6870 $ this ->assertSame ($ body , $ data ['body ' ]);
6971 }
@@ -74,7 +76,7 @@ public function testPostWithJsonBody(): void
7476 public function testCustomTimeout (): void
7577 {
7678 $ response = $ this ->adapter ->send (
77- url: 'localhost :8000 ' ,
79+ url: '127.0.0.1 :8000 ' ,
7880 method: 'GET ' ,
7981 body: null ,
8082 headers: [],
@@ -97,7 +99,7 @@ public function testCustomTimeout(): void
9799 public function testRedirectHandling (): void
98100 {
99101 $ response = $ this ->adapter ->send (
100- url: 'localhost :8000/redirect ' ,
102+ url: '127.0.0.1 :8000/redirect ' ,
101103 method: 'GET ' ,
102104 body: null ,
103105 headers: [],
@@ -113,6 +115,7 @@ public function testRedirectHandling(): void
113115 $ this ->assertInstanceOf (Response::class, $ response );
114116 $ this ->assertSame (200 , $ response ->getStatusCode ());
115117 $ data = $ response ->json ();
118+ $ this ->assertIsArray ($ data );
116119 $ this ->assertSame ('redirectedPage ' , $ data ['page ' ]);
117120 }
118121
@@ -122,7 +125,7 @@ public function testRedirectHandling(): void
122125 public function testRedirectDisabled (): void
123126 {
124127 $ response = $ this ->adapter ->send (
125- url: 'localhost :8000/redirect ' ,
128+ url: '127.0.0.1 :8000/redirect ' ,
126129 method: 'GET ' ,
127130 body: null ,
128131 headers: [],
@@ -146,7 +149,7 @@ public function testChunkCallback(): void
146149 {
147150 $ chunks = [];
148151 $ response = $ this ->adapter ->send (
149- url: 'localhost :8000/chunked ' ,
152+ url: '127.0.0.1 :8000/chunked ' ,
150153 method: 'GET ' ,
151154 body: null ,
152155 headers: [],
@@ -181,7 +184,7 @@ public function testFormDataBody(): void
181184 {
182185 $ body = ['name ' => 'John Doe ' , 'age ' => '30 ' ];
183186 $ response = $ this ->adapter ->send (
184- url: 'localhost :8000 ' ,
187+ url: '127.0.0.1 :8000 ' ,
185188 method: 'POST ' ,
186189 body: $ body ,
187190 headers: ['content-type ' => 'application/x-www-form-urlencoded ' ],
@@ -204,7 +207,7 @@ public function testFormDataBody(): void
204207 public function testResponseHeaders (): void
205208 {
206209 $ response = $ this ->adapter ->send (
207- url: 'localhost :8000 ' ,
210+ url: '127.0.0.1 :8000 ' ,
208211 method: 'GET ' ,
209212 body: null ,
210213 headers: [],
@@ -254,7 +257,7 @@ public function testFileUpload(): void
254257 ];
255258
256259 $ response = $ this ->adapter ->send (
257- url: 'localhost :8000 ' ,
260+ url: '127.0.0.1 :8000 ' ,
258261 method: 'POST ' ,
259262 body: $ body ,
260263 headers: ['content-type ' => 'multipart/form-data ' ],
@@ -270,7 +273,10 @@ public function testFileUpload(): void
270273 $ this ->assertInstanceOf (Response::class, $ response );
271274 $ this ->assertSame (200 , $ response ->getStatusCode ());
272275 $ data = $ response ->json ();
276+ $ this ->assertIsArray ($ data );
277+ $ this ->assertIsString ($ data ['files ' ]);
273278 $ files = json_decode ($ data ['files ' ], true );
279+ $ this ->assertIsArray ($ files );
274280 $ this ->assertSame ('logo.png ' , $ files ['file ' ]['name ' ]);
275281 }
276282}
0 commit comments