diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-03-27 13:10:27 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-03-27 13:10:27 +0100 |
commit | 7ad4dfa2017d5a1d956cae132a495811588e1352 (patch) | |
tree | 4145507d0f235682d3835978983f19ff0d570f55 /tests/lib | |
parent | 5aa81833f9bd70929985425c2d78628f76fe728e (diff) | |
parent | 70acd58336925ade7ff42c8ea4759a67c09b9212 (diff) | |
download | nextcloud-server-7ad4dfa2017d5a1d956cae132a495811588e1352.tar.gz nextcloud-server-7ad4dfa2017d5a1d956cae132a495811588e1352.zip |
Merge pull request #15227 from owncloud/ocetag-header
Copy Etag header to OC-Etag for sabre calls
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/connector/sabre/copyetagheaderplugintest.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/lib/connector/sabre/copyetagheaderplugintest.php b/tests/lib/connector/sabre/copyetagheaderplugintest.php new file mode 100644 index 00000000000..176f9c8d0ca --- /dev/null +++ b/tests/lib/connector/sabre/copyetagheaderplugintest.php @@ -0,0 +1,43 @@ +<?php + +namespace Tests\Connector\Sabre; + +/** + * Copyright (c) 2015 Vincent Petry <pvince81@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +class CopyEtagPluginTest extends \Test\TestCase { + + /** + * @var \OC\Connector\Sabre\CopyEtagHeaderPlugin + */ + private $plugin; + + public function setUp() { + parent::setUp(); + $this->server = new \Sabre\DAV\Server(); + $this->plugin = new \OC\Connector\Sabre\CopyEtagHeaderPlugin($this->tree); + $this->plugin->initialize($this->server); + } + + public function testCopyEtag() { + $request = new \Sabre\Http\Request(); + $response = new \Sabre\Http\Response(); + $response->setHeader('Etag', 'abcd'); + + $this->plugin->afterMethod($request, $response); + + $this->assertEquals('abcd', $response->getHeader('OC-Etag')); + } + + public function testNoopWhenEmpty() { + $request = new \Sabre\Http\Request(); + $response = new \Sabre\Http\Response(); + + $this->plugin->afterMethod($request, $response); + + $this->assertNull($response->getHeader('OC-Etag')); + } +} |