ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
HomeCollectionTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAVACL\FS;
4 
5 use Sabre\DAVACL\PrincipalBackend\Mock as PrincipalBackend;
6 
8 
14  protected $sut;
15 
16  protected $path;
17  protected $name = 'thuis';
18 
19  function setUp() {
20 
21  $principalBackend = new PrincipalBackend();
22 
23  $this->path = SABRE_TEMPDIR . '/home';
24 
25  $this->sut = new HomeCollection($principalBackend, $this->path);
26  $this->sut->collectionName = $this->name;
27 
28 
29  }
30 
31  function tearDown() {
32 
34 
35  }
36 
37  function testGetName() {
38 
39  $this->assertEquals(
40  $this->name,
41  $this->sut->getName()
42  );
43 
44  }
45 
46  function testGetChild() {
47 
48  $child = $this->sut->getChild('user1');
49  $this->assertInstanceOf('Sabre\\DAVACL\\FS\\Collection', $child);
50  $this->assertEquals('user1', $child->getName());
51 
52  $owner = 'principals/user1';
53  $acl = [
54  [
55  'privilege' => '{DAV:}all',
56  'principal' => '{DAV:}owner',
57  'protected' => true,
58  ],
59  ];
60 
61  $this->assertEquals($acl, $child->getACL());
62  $this->assertEquals($owner, $child->getOwner());
63 
64  }
65 
66  function testGetOwner() {
67 
68  $this->assertNull(
69  $this->sut->getOwner()
70  );
71 
72  }
73 
74  function testGetGroup() {
75 
76  $this->assertNull(
77  $this->sut->getGroup()
78  );
79 
80  }
81 
82  function testGetACL() {
83 
84  $acl = [
85  [
86  'principal' => '{DAV:}authenticated',
87  'privilege' => '{DAV:}read',
88  'protected' => true,
89  ]
90  ];
91 
92  $this->assertEquals(
93  $acl,
94  $this->sut->getACL()
95  );
96 
97  }
98 
102  function testSetAcl() {
103 
104  $this->sut->setACL([]);
105 
106  }
107 
109 
110  $this->assertNull(
111  $this->sut->getSupportedPrivilegeSet()
112  );
113 
114  }
115 
116 }
This collection contains a collection for every principal.
$principalBackend
static clearTempDir()
This function deletes all the contents of the temporary directory.
Definition: TestUtil.php:12