summaryrefslogtreecommitdiffstats
path: root/tests/lib/appframework/http/ResponseTest.php
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2014-03-09 23:01:16 +0100
committerThomas Tanghus <thomas@tanghus.net>2014-03-09 23:01:16 +0100
commit8f6ea900f2f75bfdfadb7f484ec64ac7ea78623c (patch)
tree4d542871564df3e12db36cc83a8dfd2ea9f0f88c /tests/lib/appframework/http/ResponseTest.php
parent9a31e533130ed6902719051bb854d0994d6ff86b (diff)
downloadnextcloud-server-8f6ea900f2f75bfdfadb7f484ec64ac7ea78623c.tar.gz
nextcloud-server-8f6ea900f2f75bfdfadb7f484ec64ac7ea78623c.zip
Chainable Response in AppFramework
Diffstat (limited to 'tests/lib/appframework/http/ResponseTest.php')
-rw-r--r--tests/lib/appframework/http/ResponseTest.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php
index 063ab8b5d33..27350725d79 100644
--- a/tests/lib/appframework/http/ResponseTest.php
+++ b/tests/lib/appframework/http/ResponseTest.php
@@ -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']);
+
+ }
}