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