summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-03-26 13:52:43 +0100
committerVincent Petry <pvince81@owncloud.com>2015-03-26 13:52:43 +0100
commitcda7f7fd6190d15a81897c4557005a6c661b8f2c (patch)
tree564d94a86b6a940ab2209ec145636ebeaaf4d203 /tests
parent468456e1688dda50c046d42fcdf3c570c6e4e50d (diff)
parent8d327c94a844804d0e7af057866e552bd5aafd17 (diff)
downloadnextcloud-server-cda7f7fd6190d15a81897c4557005a6c661b8f2c.tar.gz
nextcloud-server-cda7f7fd6190d15a81897c4557005a6c661b8f2c.zip
Merge pull request #15168 from owncloud/oc-etag-master
adding OC-ETag header
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/connector/sabre/filesplugin.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/lib/connector/sabre/filesplugin.php b/tests/lib/connector/sabre/filesplugin.php
index 54d43d66dda..e10d67a3255 100644
--- a/tests/lib/connector/sabre/filesplugin.php
+++ b/tests/lib/connector/sabre/filesplugin.php
@@ -171,4 +171,35 @@ class FilesPlugin extends \Test\TestCase {
$this->assertEquals(200, $result[self::GETETAG_PROPERTYNAME]);
}
+ /**
+ * @dataProvider providesETagTestData
+ * @param $expectedETag
+ * @param $isChunked
+ * @param $isChunkComplete
+ */
+ public function testETag($expectedETag, $isChunked, $isChunkComplete) {
+ if (!is_null($isChunked)) {
+ $_SERVER['HTTP_OC_CHUNKED'] = $isChunked;
+ }
+ if (!is_null($isChunkComplete)) {
+ $_SERVER['X-CHUNKING_COMPLETE'] = $isChunkComplete;
+ }
+ $node = $this->createTestNode('\OC\Connector\Sabre\File');
+
+ $etag = $this->plugin->getETag($node);
+
+ $this->assertEquals($expectedETag, $etag);
+ }
+
+ public function providesETagTestData() {
+ return [
+ // non-chunked tests
+ ['"abc"', null, null],
+ ['"abc"', null, false],
+
+ // chunked tests
+ [null, true, null],
+ ['"abc"', true, true],
+ ];
+ }
}