function testSendCookies() { $cookie = new Cookie("name", "value"); $this->response->addCookie($cookie); $this->request->mock(); $this->send(); $expected = array("HTTP/1.1 200 OK", "Date: " . $this->response->getHeader("Date"), "Content-Length: 0", "Set-Cookie: " . $cookie); $this->assertEquals($expected, HeaderStack::stack()); }
function testNoCacheControlWhenEmpty() { $this->cacheControl->makeCacheHeaders(); $this->assertNull($this->response->getHeader("Cache-Control")); }
function testCacheMissedHandling() { $response = new Response(); $response->whenCacheMissed(function () use($response) { $response->json(array(1, 2, 3)); }); $response->cacheMissed(); $this->assertEquals("application/json", $response->getHeader("Content-Type")); }