1<?php
2
3namespace Sabre\CalDAV\Subscriptions;
4
5use Sabre\DAV\PropFind;
6
7class PluginTest extends \PHPUnit_Framework_TestCase {
8
9    function testInit() {
10
11        $server = new \Sabre\DAV\Server();
12        $plugin = new Plugin();
13
14        $server->addPlugin($plugin);
15
16        $this->assertEquals(
17            '{http://calendarserver.org/ns/}subscribed',
18            $server->resourceTypeMapping['Sabre\\CalDAV\\Subscriptions\\ISubscription']
19        );
20        $this->assertEquals(
21            'Sabre\\DAV\\Xml\\Property\\Href',
22            $server->xml->elementMap['{http://calendarserver.org/ns/}source']
23        );
24
25        $this->assertEquals(
26            ['calendarserver-subscribed'],
27            $plugin->getFeatures()
28        );
29
30        $this->assertEquals(
31            'subscriptions',
32            $plugin->getPluginInfo()['name']
33        );
34
35    }
36
37    function testPropFind() {
38
39        $propName = '{http://calendarserver.org/ns/}subscribed-strip-alarms';
40        $propFind = new PropFind('foo', [$propName]);
41        $propFind->set($propName,null,200);
42
43        $plugin = new Plugin();
44        $plugin->propFind($propFind, new \Sabre\DAV\SimpleCollection('hi'));
45
46        $this->assertFalse(is_null($propFind->get($propName)));
47
48    }
49
50}
51