3 require_once 'Sabre/DAV/AbstractServer.php';
4 require_once 'Sabre/DAV/TestPlugin.php';
6 class Sabre_DAV_ServerPluginTest extends Sabre_DAV_AbstractServer {
9 * @var Sabre_DAV_TestPlugin
11 protected $testPlugin;
17 $testPlugin = new Sabre_DAV_TestPlugin();
18 $this->server->addPlugin($testPlugin);
19 $this->testPlugin = $testPlugin;
24 * @covers Sabre_DAV_ServerPlugin
26 function testBaseClass() {
28 $p = new Sabre_DAV_ServerPluginMock();
29 $this->assertEquals(array(),$p->getFeatures());
30 $this->assertEquals(array(),$p->getHTTPMethods(''));
34 function testOptions() {
38 'REQUEST_METHOD' => 'OPTIONS',
41 $request = new Sabre_HTTP_Request($serverVars);
42 $this->server->httpRequest = ($request);
43 $this->server->exec();
45 $this->assertEquals(array(
46 'DAV' => '1, 3, extended-mkcol, drinking',
47 'MS-Author-Via' => 'DAV',
48 'Allow' => 'OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT, BEER, WINE',
49 'Accept-Ranges' => 'bytes',
50 'Content-Length' => '0',
51 'X-Sabre-Version' => Sabre_DAV_Version::VERSION,
52 ),$this->response->headers);
54 $this->assertEquals('HTTP/1.1 200 OK',$this->response->status);
55 $this->assertEquals('', $this->response->body);
56 $this->assertEquals('OPTIONS',$this->testPlugin->beforeMethod);
61 function testGetPlugin() {
63 $this->assertEquals($this->testPlugin,$this->server->getPlugin(get_class($this->testPlugin)));
67 function testUnknownPlugin() {
69 $this->assertNull($this->server->getPlugin('SomeRandomClassName'));
73 function testGetSupportedReportSet() {
75 $this->assertEquals(array(), $this->testPlugin->getSupportedReportSet('/'));
79 function testGetPlugins() {
82 array(get_class($this->testPlugin) => $this->testPlugin),
83 $this->server->getPlugins()
91 class Sabre_DAV_ServerPluginMock extends Sabre_DAV_ServerPlugin {
93 function initialize(Sabre_DAV_Server $s) { }