|
|
|
@ -117,5 +117,25 @@ class ResponseTest extends \PHPUnit_Framework_TestCase { |
|
|
|
|
$this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testChainability() { |
|
|
|
|
$lastModified = new \DateTime(null, new \DateTimeZone('GMT')); |
|
|
|
|
$lastModified->setTimestamp(1); |
|
|
|
|
|
|
|
|
|
$this->childResponse->setEtag('hi') |
|
|
|
|
->setStatus(Http::STATUS_NOT_FOUND) |
|
|
|
|
->setLastModified($lastModified) |
|
|
|
|
->cacheFor(33) |
|
|
|
|
->addHeader('hello', 'world'); |
|
|
|
|
|
|
|
|
|
$headers = $this->childResponse->getHeaders(); |
|
|
|
|
|
|
|
|
|
$this->assertEquals('world', $headers['hello']); |
|
|
|
|
$this->assertEquals(Http::STATUS_NOT_FOUND, $this->childResponse->getStatus()); |
|
|
|
|
$this->assertEquals('hi', $this->childResponse->getEtag()); |
|
|
|
|
$this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']); |
|
|
|
|
$this->assertEquals('max-age=33, must-revalidate', |
|
|
|
|
$headers['Cache-Control']); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|