}); $closure = function () { $response = new Response(['format' => 'json', 'data' => ['hello' => 'world']]); $response->headers['Transfer-Encoding'] = 'chunked'; (string) $response; }; expect($closure)->toEcho("11\r\n{\"hello\":\"world\"}\r\n0\r\n"); expect($headers)->toEqual([["HTTP/1.1 200 OK"], ["Content-Type: application/json"], ["Transfer-Encoding: chunked"]]); }); }); describe("->__clone", function () { it("clones the headers but not the stream ressource", function () { $response = new Response(['body' => 'Body Message']); $new = clone $response; expect($response->headers)->not->toBe($new->headers); expect($response->stream())->toBe($new->stream()); }); it("clones cookies", function () { $response = new Response(['body' => 'Body Message']); $cookies = $response->headers->cookies; $cookies['foo'] = 'bar'; $newRequest = clone $response; $new = $newRequest->headers->cookies; expect($cookies['foo'][0])->not->toBe($new['foo'][0]); expect($cookies['foo'][0]->value())->toBe($new['foo'][0]->value()); }); }); describe("::parse()", function () { it("creates a response with some set-cookies", function () { Monkey::patch('time', function () { return strtotime('24 Dec 2015');