88
99namespace Test \Http \Client ;
1010
11- use Guzzle \Stream \Stream ;
11+ use GuzzleHttp \Stream \Stream ;
1212use GuzzleHttp \Message \Response as GuzzleResponse ;
1313use OC \Http \Client \Response ;
1414
@@ -27,12 +27,33 @@ public function setUp() {
2727 $ this ->response = new Response ($ this ->guzzleResponse );
2828 }
2929
30+ public function testGetBody () {
31+ $ this ->guzzleResponse ->setBody (Stream::factory ('MyResponse ' ));
32+ $ this ->assertSame ('MyResponse ' , $ this ->response ->getBody ());
33+ }
34+
3035 public function testGetStatusCode () {
31- $ this ->assertEquals (1337 , $ this ->response ->getStatusCode ());
36+ $ this ->assertSame (1337 , $ this ->response ->getStatusCode ());
3237 }
3338
3439 public function testGetHeader () {
3540 $ this ->guzzleResponse ->setHeader ('bar ' , 'foo ' );
36- $ this ->assertEquals ('foo ' , $ this ->response ->getHeader ('bar ' ));
41+ $ this ->assertSame ('foo ' , $ this ->response ->getHeader ('bar ' ));
42+ }
43+
44+ public function testGetHeaders () {
45+ $ this ->guzzleResponse ->setHeader ('bar ' , 'foo ' );
46+ $ this ->guzzleResponse ->setHeader ('x-awesome ' , 'yes ' );
47+
48+ $ expected = [
49+ 'bar ' => [
50+ 0 => 'foo ' ,
51+ ],
52+ 'x-awesome ' => [
53+ 0 => 'yes ' ,
54+ ],
55+ ];
56+ $ this ->assertSame ($ expected , $ this ->response ->getHeaders ());
57+ $ this ->assertSame ('yes ' , $ this ->response ->getHeader ('x-awesome ' ));
3758 }
3859}
0 commit comments