ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PluginUpdatePropertiesTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAVACL;
4 
5 use Sabre\DAV;
6 
8 
10 
11  $tree = [
12  new DAV\SimpleCollection('foo'),
13  ];
14  $server = new DAV\Server($tree);
15  $server->addPlugin(new DAV\Auth\Plugin());
16  $server->addPlugin(new Plugin());
17 
18  $result = $server->updateProperties('foo', [
19  '{DAV:}foo' => 'bar',
20  ]);
21 
22  $expected = [
23  '{DAV:}foo' => 403,
24  ];
25 
26  $this->assertEquals($expected, $result);
27 
28  }
29 
31 
32  $tree = [
33  new MockPrincipal('foo', 'foo'),
34  ];
35  $server = new DAV\Server($tree);
36  $plugin = new Plugin();
37  $plugin->allowUnauthenticatedAccess = false;
38  $server->addPlugin($plugin);
39 
40  $result = $server->updateProperties('foo', [
41  '{DAV:}group-member-set' => null,
42  ]);
43 
44  $expected = [
45  '{DAV:}group-member-set' => 204
46  ];
47 
48  $this->assertEquals($expected, $result);
49  $this->assertEquals([], $tree[0]->getGroupMemberSet());
50 
51  }
52 
53  function testSetGroupMembers() {
54 
55  $tree = [
56  new MockPrincipal('foo', 'foo'),
57  ];
58  $server = new DAV\Server($tree);
59  $plugin = new Plugin();
60  $plugin->allowUnauthenticatedAccess = false;
61  $server->addPlugin($plugin);
62 
63  $result = $server->updateProperties('foo', [
64  '{DAV:}group-member-set' => new DAV\Xml\Property\Href(['/bar', '/baz'], true),
65  ]);
66 
67  $expected = [
68  '{DAV:}group-member-set' => 200
69  ];
70 
71  $this->assertEquals($expected, $result);
72  $this->assertEquals(['bar', 'baz'], $tree[0]->getGroupMemberSet());
73 
74  }
75 
79  function testSetBadValue() {
80 
81  $tree = [
82  new MockPrincipal('foo', 'foo'),
83  ];
84  $server = new DAV\Server($tree);
85  $plugin = new Plugin();
86  $plugin->allowUnauthenticatedAccess = false;
87  $server->addPlugin($plugin);
88 
89  $result = $server->updateProperties('foo', [
90  '{DAV:}group-member-set' => new \StdClass(),
91  ]);
92 
93  }
94 
95  function testSetBadNode() {
96 
97  $tree = [
98  new DAV\SimpleCollection('foo'),
99  ];
100  $server = new DAV\Server($tree);
101  $plugin = new Plugin();
102  $plugin->allowUnauthenticatedAccess = false;
103  $server->addPlugin($plugin);
104 
105  $result = $server->updateProperties('foo', [
106  '{DAV:}group-member-set' => new DAV\Xml\Property\Href(['/bar', '/baz'], false),
107  ]);
108 
109  $expected = [
110  '{DAV:}group-member-set' => 403,
111  ];
112 
113  $this->assertEquals($expected, $result);
114 
115  }
116 }
$result
$server
Definition: sabredav.php:48
Href property.
Definition: Href.php:26
Main DAV server class.
Definition: Server.php:23
SabreDAV ACL Plugin.
Definition: Plugin.php:31