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 ()
 Sabre More...
 
 testGetName ()
 
 testGetDisplayName ()
 
 testGetProperties ()
 
 testUpdateProperties ()
 
 testGetPrincipalUrl ()
 
 testGetAlternateUriSet ()
 
 testGetAlternateUriSetEmpty ()
 
 testGetGroupMemberSet ()
 
 testGetGroupMembership ()
 
 testSetGroupMemberSet ()
 
 testGetOwner ()
 
 testGetGroup ()
 
 testGetACl ()
 
 testSetACl ()
 
 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.

References $principalBackend.

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

◆ testConstructNoUri()

Sabre\DAVACL\PrincipalTest::testConstructNoUri ( )

Sabre

Definition at line 21 of file PrincipalTest.php.

References $principalBackend.

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

◆ testGetACl()

Sabre\DAVACL\PrincipalTest::testGetACl ( )

Definition at line 175 of file PrincipalTest.php.

References $principalBackend.

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  }
$principalBackend

◆ testGetAlternateUriSet()

Sabre\DAVACL\PrincipalTest::testGetAlternateUriSet ( )

Definition at line 95 of file PrincipalTest.php.

References $principalBackend.

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  }
$principalBackend

◆ testGetAlternateUriSetEmpty()

Sabre\DAVACL\PrincipalTest::testGetAlternateUriSetEmpty ( )

Definition at line 119 of file PrincipalTest.php.

References $principalBackend.

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  }
$principalBackend

◆ testGetDisplayName()

Sabre\DAVACL\PrincipalTest::testGetDisplayName ( )

Definition at line 36 of file PrincipalTest.php.

References $principalBackend.

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  }
$principalBackend

◆ testGetGroup()

Sabre\DAVACL\PrincipalTest::testGetGroup ( )

Definition at line 167 of file PrincipalTest.php.

References $principalBackend.

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

◆ testGetGroupMemberSet()

Sabre\DAVACL\PrincipalTest::testGetGroupMemberSet ( )

Definition at line 132 of file PrincipalTest.php.

References $principalBackend.

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

◆ testGetGroupMembership()

Sabre\DAVACL\PrincipalTest::testGetGroupMembership ( )

Definition at line 139 of file PrincipalTest.php.

References $principalBackend.

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

◆ testGetName()

Sabre\DAVACL\PrincipalTest::testGetName ( )

Definition at line 28 of file PrincipalTest.php.

References $principalBackend.

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

◆ testGetOwner()

Sabre\DAVACL\PrincipalTest::testGetOwner ( )

Definition at line 159 of file PrincipalTest.php.

References $principalBackend.

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

◆ testGetPrincipalUrl()

Sabre\DAVACL\PrincipalTest::testGetPrincipalUrl ( )

Definition at line 87 of file PrincipalTest.php.

References $principalBackend.

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

◆ testGetProperties()

Sabre\DAVACL\PrincipalTest::testGetProperties ( )

Definition at line 50 of file PrincipalTest.php.

References $key, $keys, and $principalBackend.

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  }
$keys
$key
Definition: croninfo.php:18
$principalBackend

◆ testGetSupportedPrivilegeSet()

Sabre\DAVACL\PrincipalTest::testGetSupportedPrivilegeSet ( )

Definition at line 200 of file PrincipalTest.php.

References $principalBackend.

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

◆ testSetACl()

Sabre\DAVACL\PrincipalTest::testSetACl ( )

Definition at line 192 of file PrincipalTest.php.

References $principalBackend.

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

◆ testSetGroupMemberSet()

Sabre\DAVACL\PrincipalTest::testSetGroupMemberSet ( )

Definition at line 147 of file PrincipalTest.php.

References $principalBackend.

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  }
$principalBackend

◆ testUpdateProperties()

Sabre\DAVACL\PrincipalTest::testUpdateProperties ( )

Definition at line 74 of file PrincipalTest.php.

References $principalBackend, and $result.

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
$principalBackend

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