Browse Source

Add failing test for Http/Client/Response

This shows that it's not possible to get response body content using PSR7 methods.
ADmad 8 years ago
parent
commit
d8cd4ca7ec
1 changed files with 4 additions and 2 deletions
  1. 4 2
      tests/TestCase/Http/Client/ResponseTest.php

+ 4 - 2
tests/TestCase/Http/Client/ResponseTest.php

@@ -102,10 +102,12 @@ class ResponseTest extends TestCase
         $encoded = json_encode($data);
 
         $response = new Response([], $encoded);
-        $result = $response->body('json_decode');
-        $this->assertEquals($data['property'], $result->property);
+
+        $this->assertEquals($encoded, $response->getBody()->getContents());
         $this->assertEquals($encoded, $response->body());
 
+        $result = $response->body('json_decode');
+        $this->assertEquals($data['property'], $result->property);
         $this->assertEquals($encoded, $response->body);
         $this->assertTrue(isset($response->body));
     }