<?php namespace Lead\Net\Spec\Suite\Http; use Lead\Net\NetException; use Lead\Net\Http\Request; use Lead\Net\Http\Response; use Kahlan\Plugin\Monkey; describe("Response", function () { describe("->__construct()", function () { it("sets defaults values", function () { $response = new Response(); expect($response->export())->toBe(['status' => [200, 'OK'], 'version' => '1.1', 'headers' => $response->headers, 'body' => $response->stream()]); }); it("sets status", function () { $response = new Response(['status' => 404]); expect($response->status())->toEqual([404, 'Not Found']); }); it("sets set-cookies", function () { $response = new Response(['cookies' => ['foo' => 'bar', 'bar' => 'foo']]); expect($response->headers->cookies->data())->toEqual(['foo' => [['value' => 'bar', 'expires' => null, 'path' => '/', 'domain' => null, 'max-age' => null, 'secure' => false, 'httponly' => false]], 'bar' => [['value' => 'foo', 'expires' => null, 'path' => '/', 'domain' => null, 'max-age' => null, 'secure' => false, 'httponly' => false]]]); }); }); describe("->status()", function () { it("sets the request's status using an integer", function () { $response = new Response(); expect($response->status(404))->toBe($response); expect($response->status())->toEqual([404, 'Not Found']); }); it("sets the request's status using an array", function () { $response = new Response();