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

Public Member Functions

 setUp ()
 
 testFreeBusyReport ()
 
 testFreeBusyReportNoTimeRange ()
 @expectedException Sabre\DAV\Exception\BadRequest More...
 
 testFreeBusyReportWrongNode ()
 @expectedException Sabre\DAV\Exception\NotImplemented More...
 
 testFreeBusyReportNoACLPlugin ()
 @expectedException Sabre\DAV\Exception More...
 

Protected Attributes

 $plugin
 
 $server
 

Detailed Description

Definition at line 11 of file FreeBusyReportTest.php.

Member Function Documentation

◆ setUp()

Sabre\CalDAV\FreeBusyReportTest::setUp ( )

Definition at line 22 of file FreeBusyReportTest.php.

22 {
23
24 $obj1 = <<<ics
25BEGIN:VCALENDAR
26BEGIN:VEVENT
27DTSTART:20111005T120000Z
28DURATION:PT1H
29END:VEVENT
30END:VCALENDAR
31ics;
32
33 $obj2 = fopen('php://memory', 'r+');
34 fwrite($obj2, <<<ics
35BEGIN:VCALENDAR
36BEGIN:VEVENT
37DTSTART:20121005T120000Z
38DURATION:PT1H
39END:VEVENT
40END:VCALENDAR
41ics
42 );
43 rewind($obj2);
44
45 $obj3 = <<<ics
46BEGIN:VCALENDAR
47BEGIN:VEVENT
48DTSTART:20111006T120000
49DURATION:PT1H
50END:VEVENT
51END:VCALENDAR
52ics;
53
54 $calendarData = [
55 1 => [
56 'obj1' => [
57 'calendarid' => 1,
58 'uri' => 'event1.ics',
59 'calendardata' => $obj1,
60 ],
61 'obj2' => [
62 'calendarid' => 1,
63 'uri' => 'event2.ics',
64 'calendardata' => $obj2
65 ],
66 'obj3' => [
67 'calendarid' => 1,
68 'uri' => 'event3.ics',
69 'calendardata' => $obj3
70 ]
71 ],
72 ];
73
74
75 $caldavBackend = new Backend\Mock([], $calendarData);
76
77 $calendar = new Calendar($caldavBackend, [
78 'id' => 1,
79 'uri' => 'calendar',
80 'principaluri' => 'principals/user1',
81 '{' . Plugin::NS_CALDAV . '}calendar-timezone' => "BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Berlin\r\nEND:VTIMEZONE\r\nEND:VCALENDAR",
82 ]);
83
84 $this->server = new DAV\Server([$calendar]);
85
87 'REQUEST_URI' => '/calendar',
88 ]);
89 $this->server->httpRequest = $request;
90 $this->server->httpResponse = new HTTP\ResponseMock();
91
92 $this->plugin = new Plugin();
93 $this->server->addPlugin($this->plugin);
94
95 }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const NS_CALDAV
This is the official CalDAV namespace.
Definition: Plugin.php:33
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
$caldavBackend

References $caldavBackend, $calendar, $request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\CalDAV\Plugin\NS_CALDAV.

+ Here is the call graph for this function:

◆ testFreeBusyReport()

Sabre\CalDAV\FreeBusyReportTest::testFreeBusyReport ( )

Definition at line 97 of file FreeBusyReportTest.php.

97 {
98
99 $reportXML = <<<XML
100<?xml version="1.0"?>
101<c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav">
102 <c:time-range start="20111001T000000Z" end="20111101T000000Z" />
103</c:free-busy-query>
104XML;
105
106 $report = $this->server->xml->parse($reportXML, null, $rootElem);
107 $this->plugin->report($rootElem, $report, null);
108
109 $this->assertEquals(200, $this->server->httpResponse->status);
110 $this->assertEquals('text/calendar', $this->server->httpResponse->getHeader('Content-Type'));
111 $this->assertTrue(strpos($this->server->httpResponse->body, 'BEGIN:VFREEBUSY') !== false);
112 $this->assertTrue(strpos($this->server->httpResponse->body, '20111005T120000Z/20111005T130000Z') !== false);
113 $this->assertTrue(strpos($this->server->httpResponse->body, '20111006T100000Z/20111006T110000Z') !== false);
114
115 }

◆ testFreeBusyReportNoACLPlugin()

Sabre\CalDAV\FreeBusyReportTest::testFreeBusyReportNoACLPlugin ( )

@expectedException Sabre\DAV\Exception

Definition at line 157 of file FreeBusyReportTest.php.

157 {
158
159 $this->server = new DAV\Server();
160 $this->plugin = new Plugin();
161 $this->server->addPlugin($this->plugin);
162
163 $reportXML = <<<XML
164<?xml version="1.0"?>
165<c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav">
166 <c:time-range start="20111001T000000Z" end="20111101T000000Z" />
167</c:free-busy-query>
168XML;
169
170 $report = $this->server->xml->parse($reportXML, null, $rootElem);
171 $this->plugin->report($rootElem, $report, null);
172
173 }

◆ testFreeBusyReportNoTimeRange()

Sabre\CalDAV\FreeBusyReportTest::testFreeBusyReportNoTimeRange ( )

@expectedException Sabre\DAV\Exception\BadRequest

Definition at line 120 of file FreeBusyReportTest.php.

120 {
121
122 $reportXML = <<<XML
123<?xml version="1.0"?>
124<c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav">
125</c:free-busy-query>
126XML;
127
128 $report = $this->server->xml->parse($reportXML, null, $rootElem);
129
130 }

◆ testFreeBusyReportWrongNode()

Sabre\CalDAV\FreeBusyReportTest::testFreeBusyReportWrongNode ( )

@expectedException Sabre\DAV\Exception\NotImplemented

Definition at line 135 of file FreeBusyReportTest.php.

135 {
136
138 'REQUEST_URI' => '/',
139 ]);
140 $this->server->httpRequest = $request;
141
142 $reportXML = <<<XML
143<?xml version="1.0"?>
144<c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav">
145 <c:time-range start="20111001T000000Z" end="20111101T000000Z" />
146</c:free-busy-query>
147XML;
148
149 $report = $this->server->xml->parse($reportXML, null, $rootElem);
150 $this->plugin->report($rootElem, $report, null);
151
152 }

References $request, and Sabre\HTTP\Sapi\createFromServerArray().

+ Here is the call graph for this function:

Field Documentation

◆ $plugin

Sabre\CalDAV\FreeBusyReportTest::$plugin
protected

Definition at line 16 of file FreeBusyReportTest.php.

◆ $server

Sabre\CalDAV\FreeBusyReportTest::$server
protected

Definition at line 20 of file FreeBusyReportTest.php.


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