ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
NodeTest.php
Go to the documentation of this file.
1<?php
2
4
6
8
9 protected $systemStatus;
10 protected $caldavBackend;
11
12 function getInstance() {
13
14 $principalUri = 'principals/user1';
15
16 $this->systemStatus = new CalDAV\Xml\Notification\SystemStatus(1, '"1"');
17
18 $this->caldavBackend = new CalDAV\Backend\MockSharing([], [], [
19 'principals/user1' => [
20 $this->systemStatus
21 ]
22 ]);
23
24 $node = new Node($this->caldavBackend, 'principals/user1', $this->systemStatus);
25 return $node;
26
27 }
28
29 function testGetId() {
30
31 $node = $this->getInstance();
32 $this->assertEquals($this->systemStatus->getId() . '.xml', $node->getName());
33
34 }
35
36 function testGetEtag() {
37
38 $node = $this->getInstance();
39 $this->assertEquals('"1"', $node->getETag());
40
41 }
42
44
45 $node = $this->getInstance();
46 $this->assertEquals($this->systemStatus, $node->getNotificationType());
47
48 }
49
50 function testDelete() {
51
52 $node = $this->getInstance();
53 $node->delete();
54 $this->assertEquals([], $this->caldavBackend->getNotificationsForPrincipal('principals/user1'));
55
56 }
57
58 function testGetGroup() {
59
60 $node = $this->getInstance();
61 $this->assertNull($node->getGroup());
62
63 }
64
65 function testGetACL() {
66
67 $node = $this->getInstance();
68 $expected = [
69 [
70 'privilege' => '{DAV:}all',
71 'principal' => '{DAV:}owner',
72 'protected' => true,
73 ],
74 ];
75
76 $this->assertEquals($expected, $node->getACL());
77
78 }
79
83 function testSetACL() {
84
85 $node = $this->getInstance();
86 $node->setACL([]);
87
88 }
89
91
92 $node = $this->getInstance();
93 $this->assertNull($node->getSupportedPrivilegeSet());
94
95 }
96}
An exception for terminatinating execution or to throw for unit testing.
testSetACL()
@expectedException \Sabre\DAV\Exception\Forbidden
Definition: NodeTest.php:83
This node represents a single notification.
Definition: Node.php:21