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 ()
 Sabre More...
 
 testFreeBusyReportWrongNode ()
 Sabre More...
 
 testFreeBusyReportNoACLPlugin ()
 Sabre 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.

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

22  {
23 
24  $obj1 = <<<ics
25 BEGIN:VCALENDAR
26 BEGIN:VEVENT
27 DTSTART:20111005T120000Z
28 DURATION:PT1H
29 END:VEVENT
30 END:VCALENDAR
31 ics;
32 
33  $obj2 = fopen('php://memory', 'r+');
34  fwrite($obj2, <<<ics
35 BEGIN:VCALENDAR
36 BEGIN:VEVENT
37 DTSTART:20121005T120000Z
38 DURATION:PT1H
39 END:VEVENT
40 END:VCALENDAR
41 ics
42  );
43  rewind($obj2);
44 
45  $obj3 = <<<ics
46 BEGIN:VCALENDAR
47 BEGIN:VEVENT
48 DTSTART:20111006T120000
49 DURATION:PT1H
50 END:VEVENT
51 END:VCALENDAR
52 ics;
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
$caldavBackend
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
const NS_CALDAV
This is the official CalDAV namespace.
Definition: Plugin.php:33
+ 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>
104 XML;
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 ( )

Sabre

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>
168 XML;
169 
170  $report = $this->server->xml->parse($reportXML, null, $rootElem);
171  $this->plugin->report($rootElem, $report, null);
172 
173  }

◆ testFreeBusyReportNoTimeRange()

Sabre\CalDAV\FreeBusyReportTest::testFreeBusyReportNoTimeRange ( )

Sabre

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>
126 XML;
127 
128  $report = $this->server->xml->parse($reportXML, null, $rootElem);
129 
130  }

◆ testFreeBusyReportWrongNode()

Sabre\CalDAV\FreeBusyReportTest::testFreeBusyReportWrongNode ( )

Sabre

Definition at line 135 of file FreeBusyReportTest.php.

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

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>
147 XML;
148 
149  $report = $this->server->xml->parse($reportXML, null, $rootElem);
150  $this->plugin->report($rootElem, $report, null);
151 
152  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
+ 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: