]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/CalDAV/Principal/ProxyReadTest.php
41ec2f260fd75a6d793acbf7882920147255968b
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / CalDAV / Principal / ProxyReadTest.php
1 <?php
2
3 class Sabre_CalDAV_Principal_ProxyReadTest extends PHPUnit_Framework_TestCase {
4
5     protected $backend;
6
7     function getInstance() {
8
9         $backend = new Sabre_DAVACL_MockPrincipalBackend();
10         $principal = new Sabre_CalDAV_Principal_ProxyRead($backend, array(
11             'uri' => 'principal/user',
12         ));
13         $this->backend = $backend;
14         return $principal;
15
16    }
17
18     function testGetName() {
19
20         $i = $this->getInstance();
21         $this->assertEquals('calendar-proxy-read', $i->getName());
22
23     }
24     function testGetDisplayName() {
25
26         $i = $this->getInstance();
27         $this->assertEquals('calendar-proxy-read', $i->getDisplayName());
28
29     }
30
31     function testGetLastModified() {
32
33         $i = $this->getInstance();
34         $this->assertNull($i->getLastModified());
35
36     }
37
38     /**
39      * @expectedException Sabre_DAV_Exception_Forbidden
40      */
41     function testDelete() {
42
43         $i = $this->getInstance();
44         $i->delete();
45
46     }
47
48     /**
49      * @expectedException Sabre_DAV_Exception_Forbidden
50      */
51     function testSetName() {
52
53         $i = $this->getInstance();
54         $i->setName('foo');
55
56     }
57
58     function testGetAlternateUriSet() {
59
60         $i = $this->getInstance();
61         $this->assertEquals(array(), $i->getAlternateUriSet());
62
63     }
64
65     function testGetPrincipalUri() {
66
67         $i = $this->getInstance();
68         $this->assertEquals('principal/user/calendar-proxy-read', $i->getPrincipalUrl());
69
70     }
71
72     function testGetGroupMemberSet() {
73
74         $i = $this->getInstance();
75         $this->assertEquals(array(), $i->getGroupMemberSet());
76
77     }
78
79     function testGetGroupMembership() {
80
81         $i = $this->getInstance();
82         $this->assertEquals(array(), $i->getGroupMembership());
83
84     }
85
86     function testSetGroupMemberSet() {
87
88         $i = $this->getInstance();
89         $i->setGroupMemberSet(array('principals/foo'));
90
91         $expected = array(
92             $i->getPrincipalUrl() => array('principals/foo')
93         );
94
95         $this->assertEquals($expected, $this->backend->groupMembers);
96
97     }
98 }