]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/CalDAV/Schedule/OutboxTest.php
Merge remote branch 'friendica/master'
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / CalDAV / Schedule / OutboxTest.php
1 <?php
2
3 class Sabre_CalDAV_Schedule_OutboxTest extends PHPUnit_Framework_TestCase {
4
5     function testSetup() {
6
7         $outbox = new Sabre_CalDAV_Schedule_Outbox('principals/user1');
8         $this->assertEquals('outbox', $outbox->getName());
9         $this->assertEquals(array(), $outbox->getChildren());
10         $this->assertEquals('principals/user1', $outbox->getOwner());
11         $this->assertEquals(null, $outbox->getGroup());
12
13         $this->assertEquals(array(
14             array(
15                 'privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-query-freebusy',
16                 'principal' => 'principals/user1',
17                 'protected' => true,
18             ),
19             array(
20                 'privilege' => '{DAV:}read',
21                 'principal' => 'principals/user1',
22                 'protected' => true,
23             ),
24         ), $outbox->getACL());
25
26         $ok = false;
27         try {
28             $outbox->setACL(array());
29         } catch (Sabre_DAV_Exception_MethodNotAllowed $e) {
30             $ok = true;
31         }
32         if (!$ok) {
33             $this->fail('Exception was not emitted');
34         }
35
36     }
37
38     function testGetSupportedPrivilegeSet() {
39
40         $outbox = new Sabre_CalDAV_Schedule_Outbox('principals/user1');
41         $r = $outbox->getSupportedPrivilegeSet();
42
43         $ok = false;
44         foreach($r['aggregates'] as $priv) {
45
46             if ($priv['privilege'] == '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-query-freebusy') {
47                 $ok = true;
48             }
49         }
50
51         if (!$ok) {
52             $this->fail('{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-query-freebusy was not found as a supported privilege');
53         }
54
55     }
56
57
58 }