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

Public Member Functions

 getSub ($override=[])
 
 testValues ()
 
 testValues2 ()
 
 testSetACL ()
 @expectedException \Sabre\DAV\Exception\Forbidden More...
 
 testDelete ()
 
 testUpdateProperties ()
 
 testBadConstruct ()
 @expectedException \InvalidArgumentException More...
 

Protected Attributes

 $backend
 

Detailed Description

Definition at line 8 of file SubscriptionTest.php.

Member Function Documentation

◆ getSub()

Sabre\CalDAV\Subscriptions\SubscriptionTest::getSub (   $override = [])

Definition at line 12 of file SubscriptionTest.php.

12 {
13
14 $caldavBackend = new \Sabre\CalDAV\Backend\MockSubscriptionSupport([], []);
15
16 $info = [
17 '{http://calendarserver.org/ns/}source' => new Href('http://example.org/src', false),
18 'lastmodified' => date('2013-04-06 11:40:00'), // tomorrow is my birthday!
19 '{DAV:}displayname' => 'displayname',
20 ];
21
22
23 $id = $caldavBackend->createSubscription('principals/user1', 'uri', array_merge($info, $override));
24 $subInfo = $caldavBackend->getSubscriptionsForUser('principals/user1');
25
26 $this->assertEquals(1, count($subInfo));
27 $subscription = new Subscription($caldavBackend, $subInfo[0]);
28
29 $this->backend = $caldavBackend;
30 return $subscription;
31
32 }
if(!array_key_exists('StateId', $_REQUEST)) $id
$caldavBackend
$info
Definition: index.php:5

References $caldavBackend, $id, and $info.

Referenced by Sabre\CalDAV\Subscriptions\SubscriptionTest\testDelete(), Sabre\CalDAV\Subscriptions\SubscriptionTest\testSetACL(), Sabre\CalDAV\Subscriptions\SubscriptionTest\testUpdateProperties(), Sabre\CalDAV\Subscriptions\SubscriptionTest\testValues(), and Sabre\CalDAV\Subscriptions\SubscriptionTest\testValues2().

+ Here is the caller graph for this function:

◆ testBadConstruct()

Sabre\CalDAV\Subscriptions\SubscriptionTest::testBadConstruct ( )

@expectedException \InvalidArgumentException

Definition at line 124 of file SubscriptionTest.php.

124 {
125
126 $caldavBackend = new \Sabre\CalDAV\Backend\MockSubscriptionSupport([], []);
127 new Subscription($caldavBackend, []);
128
129 }

References $caldavBackend.

◆ testDelete()

Sabre\CalDAV\Subscriptions\SubscriptionTest::testDelete ( )

Definition at line 96 of file SubscriptionTest.php.

96 {
97
98 $sub = $this->getSub();
99 $sub->delete();
100
101 $this->assertEquals([], $this->backend->getSubscriptionsForUser('principals1/user1'));
102
103 }

References Sabre\CalDAV\Subscriptions\SubscriptionTest\getSub().

+ Here is the call graph for this function:

◆ testSetACL()

Sabre\CalDAV\Subscriptions\SubscriptionTest::testSetACL ( )

@expectedException \Sabre\DAV\Exception\Forbidden

Definition at line 89 of file SubscriptionTest.php.

89 {
90
91 $sub = $this->getSub();
92 $sub->setACL([]);
93
94 }

References Sabre\CalDAV\Subscriptions\SubscriptionTest\getSub().

+ Here is the call graph for this function:

◆ testUpdateProperties()

Sabre\CalDAV\Subscriptions\SubscriptionTest::testUpdateProperties ( )

Definition at line 105 of file SubscriptionTest.php.

105 {
106
107 $sub = $this->getSub();
108 $propPatch = new PropPatch([
109 '{DAV:}displayname' => 'foo',
110 ]);
111 $sub->propPatch($propPatch);
112 $this->assertTrue($propPatch->commit());
113
114 $this->assertEquals(
115 'foo',
116 $this->backend->getSubscriptionsForUser('principals/user1')[0]['{DAV:}displayname']
117 );
118
119 }

References Sabre\CalDAV\Subscriptions\SubscriptionTest\getSub().

+ Here is the call graph for this function:

◆ testValues()

Sabre\CalDAV\Subscriptions\SubscriptionTest::testValues ( )

Definition at line 34 of file SubscriptionTest.php.

34 {
35
36 $sub = $this->getSub();
37
38 $this->assertEquals('uri', $sub->getName());
39 $this->assertEquals(date('2013-04-06 11:40:00'), $sub->getLastModified());
40 $this->assertEquals([], $sub->getChildren());
41
42 $this->assertEquals(
43 [
44 '{DAV:}displayname' => 'displayname',
45 '{http://calendarserver.org/ns/}source' => new Href('http://example.org/src', false),
46 ],
47 $sub->getProperties(['{DAV:}displayname', '{http://calendarserver.org/ns/}source'])
48 );
49
50 $this->assertEquals('principals/user1', $sub->getOwner());
51 $this->assertNull($sub->getGroup());
52
53 $acl = [
54 [
55 'privilege' => '{DAV:}all',
56 'principal' => 'principals/user1',
57 'protected' => true,
58 ],
59 [
60 'privilege' => '{DAV:}all',
61 'principal' => 'principals/user1/calendar-proxy-write',
62 'protected' => true,
63 ],
64 [
65 'privilege' => '{DAV:}read',
66 'principal' => 'principals/user1/calendar-proxy-read',
67 'protected' => true,
68 ]
69 ];
70 $this->assertEquals($acl, $sub->getACL());
71
72 $this->assertNull($sub->getSupportedPrivilegeSet());
73
74 }

References Sabre\CalDAV\Subscriptions\SubscriptionTest\getSub().

+ Here is the call graph for this function:

◆ testValues2()

Sabre\CalDAV\Subscriptions\SubscriptionTest::testValues2 ( )

Definition at line 76 of file SubscriptionTest.php.

76 {
77
78 $sub = $this->getSub([
79 'lastmodified' => null,
80 ]);
81
82 $this->assertEquals(null, $sub->getLastModified());
83
84 }

References Sabre\CalDAV\Subscriptions\SubscriptionTest\getSub().

+ Here is the call graph for this function:

Field Documentation

◆ $backend

Sabre\CalDAV\Subscriptions\SubscriptionTest::$backend
protected

Definition at line 10 of file SubscriptionTest.php.


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