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

Public Member Functions

 testGet ()
 
 testMultiGet ()
 
 testCalendarQueryDepth1 ()
 
 testCalendarQueryDepth0 ()
 
 testValidateICalendar ()
 
- Public Member Functions inherited from Sabre\DAVServerTest
 setUp ()
 
 initializeEverything ()
 
 request ($request, $expectedStatus=null)
 Makes a request, and returns a response object. More...
 
 autoLogin ($userName)
 This function takes a username and sets the server in a state where this user is logged in, and no longer requires an authentication check. More...
 
 setUpTree ()
 Override this to provide your own Tree for your test-case. More...
 
 setUpBackends ()
 
 assertHttpStatus ($expectedStatus, HTTP\Request $req)
 

Protected Attributes

 $setupCalDAV = true
 
 $caldavCalendars
 
 $caldavCalendarObjects
 
- Protected Attributes inherited from Sabre\DAVServerTest
 $setupCalDAV = false
 
 $setupCardDAV = false
 
 $setupACL = false
 
 $setupCalDAVSharing = false
 
 $setupCalDAVScheduling = false
 
 $setupCalDAVSubscriptions = false
 
 $setupCalDAVICSExport = false
 
 $setupLocks = false
 
 $setupFiles = false
 
 $setupSharing = false
 
 $setupPropertyStorage = false
 
 $caldavCalendars = []
 An array with calendars. More...
 
 $caldavCalendarObjects = []
 
 $carddavAddressBooks = []
 
 $carddavCards = []
 
 $server
 
 $tree = []
 
 $caldavBackend
 
 $carddavBackend
 
 $principalBackend
 
 $locksBackend
 
 $propertyStorageBackend
 
 $caldavPlugin
 
 $carddavPlugin
 
 $aclPlugin
 
 $caldavSharingPlugin
 
 $caldavSchedulePlugin
 
 $authPlugin
 
 $locksPlugin
 
 $sharingPlugin
 
 $propertyStoragePlugin
 
 $autoLogin = null
 If this string is set, we will automatically log in the user with this name. More...
 

Detailed Description

Definition at line 8 of file JCalTransformTest.php.

Member Function Documentation

◆ testCalendarQueryDepth0()

Sabre\CalDAV\JCalTransformTest::testCalendarQueryDepth0 ( )

Definition at line 166 of file JCalTransformTest.php.

References $request, $response, $xml, data, and Sabre\DAVServerTest\request().

166  {
167 
168  $xml = <<<XML
169 <?xml version="1.0"?>
170 <c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
171  <d:prop>
172  <c:calendar-data content-type="application/calendar+json" />
173  </d:prop>
174  <c:filter>
175  <c:comp-filter name="VCALENDAR" />
176  </c:filter>
177 </c:calendar-query>
178 XML;
179 
180  $headers = [
181  'Depth' => '0',
182  ];
183  $request = new Request('REPORT', '/calendars/user1/foo/bar.ics', $headers, $xml);
184 
185  $response = $this->request($request);
186 
187  $this->assertEquals(207, $response->getStatus(), "Invalid response code. Full body: " . $response->getBodyAsString());
188 
189  $multiStatus = $this->server->xml->parse(
190  $response->getBodyAsString()
191  );
192 
193  $responses = $multiStatus->getResponses();
194 
195  $this->assertEquals(1, count($responses));
196 
197  $response = $responses[0]->getResponseProperties()[200]["{urn:ietf:params:xml:ns:caldav}calendar-data"];
198  $response = json_decode($response, true);
199  if (json_last_error()) {
200  $this->fail('Json decoding error: ' . json_last_error_msg());
201  }
202  $this->assertEquals(
203  [
204  'vcalendar',
205  [],
206  [
207  [
208  'vevent',
209  [],
210  [],
211  ],
212  ],
213  ],
214  $response
215  );
216 
217  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
$this data['403_header']
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testCalendarQueryDepth1()

Sabre\CalDAV\JCalTransformTest::testCalendarQueryDepth1 ( )

Definition at line 113 of file JCalTransformTest.php.

References $request, $response, $xml, data, and Sabre\DAVServerTest\request().

113  {
114 
115  $xml = <<<XML
116 <?xml version="1.0"?>
117 <c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
118  <d:prop>
119  <c:calendar-data content-type="application/calendar+json" />
120  </d:prop>
121  <c:filter>
122  <c:comp-filter name="VCALENDAR" />
123  </c:filter>
124 </c:calendar-query>
125 XML;
126 
127  $headers = [
128  'Depth' => '1',
129  ];
130  $request = new Request('REPORT', '/calendars/user1/foo', $headers, $xml);
131 
132  $response = $this->request($request);
133 
134  $this->assertEquals(207, $response->getStatus(), "Invalid response code. Full body: " . $response->getBodyAsString());
135 
136  $multiStatus = $this->server->xml->parse(
137  $response->getBodyAsString()
138  );
139 
140  $responses = $multiStatus->getResponses();
141 
142  $this->assertEquals(1, count($responses));
143 
144  $response = $responses[0]->getResponseProperties()[200]["{urn:ietf:params:xml:ns:caldav}calendar-data"];
145  $response = json_decode($response, true);
146  if (json_last_error()) {
147  $this->fail('Json decoding error: ' . json_last_error_msg());
148  }
149  $this->assertEquals(
150  [
151  'vcalendar',
152  [],
153  [
154  [
155  'vevent',
156  [],
157  [],
158  ],
159  ],
160  ],
161  $response
162  );
163 
164  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
$this data['403_header']
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testGet()

Sabre\CalDAV\JCalTransformTest::testGet ( )

Definition at line 31 of file JCalTransformTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

31  {
32 
33  $headers = [
34  'Accept' => 'application/calendar+json',
35  ];
36  $request = new Request('GET', '/calendars/user1/foo/bar.ics', $headers);
37 
38  $response = $this->request($request);
39 
40  $body = $response->getBodyAsString();
41  $this->assertEquals(200, $response->getStatus(), "Incorrect status code: " . $body);
42 
43  $response = json_decode($body, true);
44  if (json_last_error() !== JSON_ERROR_NONE) {
45  $this->fail('Json decoding error: ' . json_last_error_msg());
46  }
47  $this->assertEquals(
48  [
49  'vcalendar',
50  [],
51  [
52  [
53  'vevent',
54  [],
55  [],
56  ],
57  ],
58  ],
59  $response
60  );
61 
62  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testMultiGet()

Sabre\CalDAV\JCalTransformTest::testMultiGet ( )

Definition at line 64 of file JCalTransformTest.php.

References $request, $response, $xml, data, and Sabre\DAVServerTest\request().

64  {
65 
66  $xml = <<<XML
67 <?xml version="1.0"?>
68 <c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
69  <d:prop>
70  <c:calendar-data content-type="application/calendar+json" />
71  </d:prop>
72  <d:href>/calendars/user1/foo/bar.ics</d:href>
73 </c:calendar-multiget>
74 XML;
75 
76  $headers = [];
77  $request = new Request('REPORT', '/calendars/user1/foo', $headers, $xml);
78 
79  $response = $this->request($request);
80 
81  $this->assertEquals(207, $response->getStatus(), 'Full rsponse: ' . $response->getBodyAsString());
82 
83  $multiStatus = $this->server->xml->parse(
84  $response->getBodyAsString()
85  );
86 
87  $responses = $multiStatus->getResponses();
88  $this->assertEquals(1, count($responses));
89 
90  $response = $responses[0]->getResponseProperties()[200]["{urn:ietf:params:xml:ns:caldav}calendar-data"];
91 
92  $jresponse = json_decode($response, true);
93  if (json_last_error()) {
94  $this->fail('Json decoding error: ' . json_last_error_msg() . '. Full response: ' . $response);
95  }
96  $this->assertEquals(
97  [
98  'vcalendar',
99  [],
100  [
101  [
102  'vevent',
103  [],
104  [],
105  ],
106  ],
107  ],
108  $jresponse
109  );
110 
111  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
$this data['403_header']
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testValidateICalendar()

Sabre\CalDAV\JCalTransformTest::testValidateICalendar ( )

Definition at line 219 of file JCalTransformTest.php.

References $input.

219  {
220 
221  $input = [
222  'vcalendar',
223  [],
224  [
225  [
226  'vevent',
227  [
228  ['uid', (object)[], 'text', 'foo'],
229  ['dtstart', (object)[], 'date', '2016-04-06'],
230  ],
231  [],
232  ],
233  ],
234  ];
235  $input = json_encode($input);
236  $this->caldavPlugin->beforeWriteContent(
237  'calendars/user1/foo/bar.ics',
238  $this->server->tree->getNodeForPath('calendars/user1/foo/bar.ics'),
239  $input,
240  $modified
241  );
242 
243 
244  $expected = <<<ICS
245 BEGIN:VCALENDAR
246 VERSION:2.0
247 BEGIN:VEVENT
248 UID:foo
249 DTSTART;VALUE=DATE:20160406
250 DTSTAMP:**ANY**
251 END:VEVENT
252 END:VCALENDAR
253 ICS;
254 
255  $this->assertVObjectEqualsVObject(
256  $expected,
257  $input
258  );
259 
260  }

Field Documentation

◆ $caldavCalendarObjects

Sabre\CalDAV\JCalTransformTest::$caldavCalendarObjects
protected
Initial value:
= [
1 => [
'bar.ics' => [
'uri' => 'bar.ics'

Definition at line 20 of file JCalTransformTest.php.

◆ $caldavCalendars

Sabre\CalDAV\JCalTransformTest::$caldavCalendars
protected
Initial value:
= [
[
'id' => 1,
'principaluri' => 'principals/user1'

Definition at line 13 of file JCalTransformTest.php.

◆ $setupCalDAV

Sabre\CalDAV\JCalTransformTest::$setupCalDAV = true
protected

Definition at line 12 of file JCalTransformTest.php.


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