blob: 2080755cd51f1be47573e5ee2245e1f211f19c99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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 \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin
*/
private $plugin;
public function setUp() {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
$this->plugin = new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin();
$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'));
}
}
|