summaryrefslogtreecommitdiffstats
path: root/tests/lib/appframework/http/ResponseTest.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-04-08 22:42:43 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-04-08 22:42:43 +0200
commit73ac3d0fcd3aebade34efdbca6f48520b75729d6 (patch)
treecd8760ae45b22e1df96d4f78b4de2c914643823f /tests/lib/appframework/http/ResponseTest.php
parentc1345d3a2d7ba18859bc836f23628322b8ebc0e0 (diff)
parenta1aacc18dff11351b555304a5361a73e13684bd1 (diff)
downloadnextcloud-server-73ac3d0fcd3aebade34efdbca6f48520b75729d6.tar.gz
nextcloud-server-73ac3d0fcd3aebade34efdbca6f48520b75729d6.zip
Merge pull request #7643 from owncloud/chainable_response
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']);
+
+ }
}