summaryrefslogtreecommitdiffstats
path: root/tests/lib/appframework/http/ResponseTest.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2014-05-07 17:54:38 +0200
committerBart Visscher <bartv@thisnet.nl>2014-05-07 17:54:38 +0200
commitf569c721a64486d0e7c7e307ed77ac0caed2dc2d (patch)
treedf7b3399a858ffdae6bd6e66616746efbcee24bc /tests/lib/appframework/http/ResponseTest.php
parent47d70da2f5cb55ad47023b061b68062dd8b8d8e2 (diff)
parent254fa5eb22efa5ba572702064377a6ad9eec9a53 (diff)
downloadnextcloud-server-f569c721a64486d0e7c7e307ed77ac0caed2dc2d.tar.gz
nextcloud-server-f569c721a64486d0e7c7e307ed77ac0caed2dc2d.zip
Merge branch 'master' into optimize-startup-queries
Conflicts: apps/files_sharing/lib/sharedstorage.php tests/lib/group/manager.php removed hasFilesSharedWith from lib/public/share.php and sharedstorage.php to fix merge
Diffstat (limited to 'tests/lib/appframework/http/ResponseTest.php')
-rw-r--r--tests/lib/appframework/http/ResponseTest.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php
index 4f21d77a170..27350725d79 100644
--- a/tests/lib/appframework/http/ResponseTest.php
+++ b/tests/lib/appframework/http/ResponseTest.php
@@ -78,7 +78,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase {
public function testGetEtag() {
$this->childResponse->setEtag('hi');
- $this->assertEquals('hi', $this->childResponse->getEtag());
+ $this->assertSame('hi', $this->childResponse->getEtag());
}
@@ -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']);
+
+ }
}