Skip to content

Commit 4c07220

Browse files
committed
response header line
1 parent 108089f commit 4c07220

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/Api/ClientTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types = 1);
22
/**
33
*
44
*/
@@ -35,10 +35,10 @@ function test_error()
3535

3636
$response = $exception->getResponse();
3737

38-
$result = json_decode($response->getBody());
38+
$result = json_decode((string) $response->getBody());
3939

4040
$this->assertEquals(404, $response->getStatusCode());
41-
$this->assertEquals('application/json', $response->getHeaders()['content-type'][0]);
41+
$this->assertEquals('application/json', $response->getHeaderLine('content-type'));
4242
$this->assertEquals('Not Found', $response->getReasonPhrase());
4343
$this->assertEquals('Not Found', $result->message);
4444
$this->assertEquals('The server can not find the requested resource.', $result->description);
@@ -58,10 +58,10 @@ function test_exception()
5858

5959
$response = $exception->getResponse();
6060

61-
$result = json_decode($response->getBody());
61+
$result = json_decode((string) $response->getBody());
6262

6363
$this->assertEquals(500, $response->getStatusCode());
64-
$this->assertEquals('application/json', $response->getHeaders()['content-type'][0]);
64+
$this->assertEquals('application/json', $response->getHeaderLine('content-type'));
6565
$this->assertEquals('Internal Server Error', $response->getReasonPhrase());
6666
$this->assertEquals('', $result->message);
6767
}
@@ -78,10 +78,10 @@ function test_post_form()
7878
'headers' => ['content-type' => 'application/x-www-form-urlencoded', 'accept' => 'application/json']
7979
]);
8080

81-
$result = json_decode($response->getBody());
81+
$result = json_decode((string) $response->getBody());
8282

8383
$this->assertEquals(200, $response->getStatusCode());
84-
$this->assertEquals('application/json', $response->getHeaders()['content-type'][0]);
84+
$this->assertEquals('application/json', $response->getHeaderLine('content-type'));
8585
$this->assertEquals('OK', $response->getReasonPhrase());
8686
$this->assertEquals('bar', $result->foo);
8787
$this->assertEquals('bat', $result->baz);
@@ -97,10 +97,10 @@ function test_post_json()
9797
'headers' => ['content-type' => 'application/json', 'accept' => 'application/json']
9898
]);
9999

100-
$result = json_decode($response->getBody());
100+
$result = json_decode((string) $response->getBody());
101101

102102
$this->assertEquals(200, $response->getStatusCode());
103-
$this->assertEquals('application/json', $response->getHeaders()['content-type'][0]);
103+
$this->assertEquals('application/json', $response->getHeaderLine('content-type'));
104104
$this->assertEquals('OK', $response->getReasonPhrase());
105105
$this->assertEquals('bar', $result->foo);
106106
$this->assertEquals('bat', $result->baz);

0 commit comments

Comments
 (0)