ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAVACL\PrincipalTest Class Reference
+ Inheritance diagram for Sabre\DAVACL\PrincipalTest:
+ Collaboration diagram for Sabre\DAVACL\PrincipalTest:

Public Member Functions

 testConstruct ()
 
 testConstructNoUri ()
 @expectedException Sabre\DAV\Exception More...
 
 testGetName ()
 
 testGetDisplayName ()
 
 testGetProperties ()
 
 testUpdateProperties ()
 
 testGetPrincipalUrl ()
 
 testGetAlternateUriSet ()
 
 testGetAlternateUriSetEmpty ()
 
 testGetGroupMemberSet ()
 
 testGetGroupMembership ()
 
 testSetGroupMemberSet ()
 
 testGetOwner ()
 
 testGetGroup ()
 
 testGetACl ()
 
 testSetACl ()
 @expectedException \Sabre\DAV\Exception\Forbidden More...
 
 testGetSupportedPrivilegeSet ()
 

Detailed Description

Definition at line 8 of file PrincipalTest.php.

Member Function Documentation

◆ testConstruct()

Sabre\DAVACL\PrincipalTest::testConstruct ( )

Definition at line 10 of file PrincipalTest.php.

10 {
11
12 $principalBackend = new PrincipalBackend\Mock();
13 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
14 $this->assertTrue($principal instanceof Principal);
15
16 }
$principalBackend

References $principalBackend.

◆ testConstructNoUri()

Sabre\DAVACL\PrincipalTest::testConstructNoUri ( )

@expectedException Sabre\DAV\Exception

Definition at line 21 of file PrincipalTest.php.

21 {
22
23 $principalBackend = new PrincipalBackend\Mock();
24 $principal = new Principal($principalBackend, []);
25
26 }

References $principalBackend.

◆ testGetACl()

Sabre\DAVACL\PrincipalTest::testGetACl ( )

Definition at line 175 of file PrincipalTest.php.

175 {
176
177 $principalBackend = new PrincipalBackend\Mock();
178 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
179 $this->assertEquals([
180 [
181 'privilege' => '{DAV:}all',
182 'principal' => '{DAV:}owner',
183 'protected' => true,
184 ]
185 ], $principal->getACL());
186
187 }

References $principalBackend.

◆ testGetAlternateUriSet()

Sabre\DAVACL\PrincipalTest::testGetAlternateUriSet ( )

Definition at line 95 of file PrincipalTest.php.

95 {
96
97 $principalBackend = new PrincipalBackend\Mock();
98 $principal = new Principal($principalBackend, [
99 'uri' => 'principals/admin',
100 '{DAV:}displayname' => 'Mr. Admin',
101 '{http://www.example.org/custom}custom' => 'Custom',
102 '{http://sabredav.org/ns}email-address' => 'admin@example.org',
103 '{DAV:}alternate-URI-set' => [
104 'mailto:admin+1@example.org',
105 'mailto:admin+2@example.org',
106 'mailto:admin@example.org',
107 ],
108 ]);
109
110 $expected = [
111 'mailto:admin+1@example.org',
112 'mailto:admin+2@example.org',
113 'mailto:admin@example.org',
114 ];
115
116 $this->assertEquals($expected, $principal->getAlternateUriSet());
117
118 }

References $principalBackend.

◆ testGetAlternateUriSetEmpty()

Sabre\DAVACL\PrincipalTest::testGetAlternateUriSetEmpty ( )

Definition at line 119 of file PrincipalTest.php.

119 {
120
121 $principalBackend = new PrincipalBackend\Mock();
122 $principal = new Principal($principalBackend, [
123 'uri' => 'principals/admin',
124 ]);
125
126 $expected = [];
127
128 $this->assertEquals($expected, $principal->getAlternateUriSet());
129
130 }

References $principalBackend.

◆ testGetDisplayName()

Sabre\DAVACL\PrincipalTest::testGetDisplayName ( )

Definition at line 36 of file PrincipalTest.php.

36 {
37
38 $principalBackend = new PrincipalBackend\Mock();
39 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
40 $this->assertEquals('admin', $principal->getDisplayname());
41
42 $principal = new Principal($principalBackend, [
43 'uri' => 'principals/admin',
44 '{DAV:}displayname' => 'Mr. Admin'
45 ]);
46 $this->assertEquals('Mr. Admin', $principal->getDisplayname());
47
48 }

References $principalBackend.

◆ testGetGroup()

Sabre\DAVACL\PrincipalTest::testGetGroup ( )

Definition at line 167 of file PrincipalTest.php.

167 {
168
169 $principalBackend = new PrincipalBackend\Mock();
170 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
171 $this->assertNull($principal->getGroup());
172
173 }

References $principalBackend.

◆ testGetGroupMemberSet()

Sabre\DAVACL\PrincipalTest::testGetGroupMemberSet ( )

Definition at line 132 of file PrincipalTest.php.

132 {
133
134 $principalBackend = new PrincipalBackend\Mock();
135 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
136 $this->assertEquals([], $principal->getGroupMemberSet());
137
138 }

References $principalBackend.

◆ testGetGroupMembership()

Sabre\DAVACL\PrincipalTest::testGetGroupMembership ( )

Definition at line 139 of file PrincipalTest.php.

139 {
140
141 $principalBackend = new PrincipalBackend\Mock();
142 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
143 $this->assertEquals([], $principal->getGroupMembership());
144
145 }

References $principalBackend.

◆ testGetName()

Sabre\DAVACL\PrincipalTest::testGetName ( )

Definition at line 28 of file PrincipalTest.php.

28 {
29
30 $principalBackend = new PrincipalBackend\Mock();
31 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
32 $this->assertEquals('admin', $principal->getName());
33
34 }

References $principalBackend.

◆ testGetOwner()

Sabre\DAVACL\PrincipalTest::testGetOwner ( )

Definition at line 159 of file PrincipalTest.php.

159 {
160
161 $principalBackend = new PrincipalBackend\Mock();
162 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
163 $this->assertEquals('principals/admin', $principal->getOwner());
164
165 }

References $principalBackend.

◆ testGetPrincipalUrl()

Sabre\DAVACL\PrincipalTest::testGetPrincipalUrl ( )

Definition at line 87 of file PrincipalTest.php.

87 {
88
89 $principalBackend = new PrincipalBackend\Mock();
90 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
91 $this->assertEquals('principals/admin', $principal->getPrincipalUrl());
92
93 }

References $principalBackend.

◆ testGetProperties()

Sabre\DAVACL\PrincipalTest::testGetProperties ( )

Definition at line 50 of file PrincipalTest.php.

50 {
51
52 $principalBackend = new PrincipalBackend\Mock();
53 $principal = new Principal($principalBackend, [
54 'uri' => 'principals/admin',
55 '{DAV:}displayname' => 'Mr. Admin',
56 '{http://www.example.org/custom}custom' => 'Custom',
57 '{http://sabredav.org/ns}email-address' => 'admin@example.org',
58 ]);
59
60 $keys = [
61 '{DAV:}displayname',
62 '{http://www.example.org/custom}custom',
63 '{http://sabredav.org/ns}email-address',
64 ];
65 $props = $principal->getProperties($keys);
66
67 foreach ($keys as $key) $this->assertArrayHasKey($key, $props);
68
69 $this->assertEquals('Mr. Admin', $props['{DAV:}displayname']);
70
71 $this->assertEquals('admin@example.org', $props['{http://sabredav.org/ns}email-address']);
72 }
$key
Definition: croninfo.php:18
$keys

References $key, $keys, and $principalBackend.

◆ testGetSupportedPrivilegeSet()

Sabre\DAVACL\PrincipalTest::testGetSupportedPrivilegeSet ( )

Definition at line 200 of file PrincipalTest.php.

200 {
201
202 $principalBackend = new PrincipalBackend\Mock();
203 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
204 $this->assertNull($principal->getSupportedPrivilegeSet());
205
206 }

References $principalBackend.

◆ testSetACl()

Sabre\DAVACL\PrincipalTest::testSetACl ( )

@expectedException \Sabre\DAV\Exception\Forbidden

Definition at line 192 of file PrincipalTest.php.

192 {
193
194 $principalBackend = new PrincipalBackend\Mock();
195 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
196 $principal->setACL([]);
197
198 }

References $principalBackend.

◆ testSetGroupMemberSet()

Sabre\DAVACL\PrincipalTest::testSetGroupMemberSet ( )

Definition at line 147 of file PrincipalTest.php.

147 {
148
149 $principalBackend = new PrincipalBackend\Mock();
150 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
151 $principal->setGroupMemberSet(['principals/foo']);
152
153 $this->assertEquals([
154 'principals/admin' => ['principals/foo'],
155 ], $principalBackend->groupMembers);
156
157 }

References $principalBackend.

◆ testUpdateProperties()

Sabre\DAVACL\PrincipalTest::testUpdateProperties ( )

Definition at line 74 of file PrincipalTest.php.

74 {
75
76 $principalBackend = new PrincipalBackend\Mock();
77 $principal = new Principal($principalBackend, ['uri' => 'principals/admin']);
78
79 $propPatch = new DAV\PropPatch(['{DAV:}yourmom' => 'test']);
80
81 $result = $principal->propPatch($propPatch);
82 $result = $propPatch->commit();
83 $this->assertTrue($result);
84
85 }
$result

References $principalBackend, and $result.


The documentation for this class was generated from the following file: