ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Issue205Test.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\CalDAV;
4 
5 use Sabre\HTTP;
6 use Sabre\VObject;
7 
16 
17  protected $setupCalDAV = true;
18 
19  protected $caldavCalendars = [
20  [
21  'id' => 1,
22  'name' => 'Calendar',
23  'principaluri' => 'principals/user1',
24  'uri' => 'calendar1',
25  ]
26  ];
27 
28  protected $caldavCalendarObjects = [
29  1 => [
30  'event.ics' => [
31  'calendardata' => 'BEGIN:VCALENDAR
32 VERSION:2.0
33 BEGIN:VEVENT
34 UID:20120330T155305CEST-6585fBUVgV
35 DTSTAMP:20120330T135305Z
36 DTSTART;TZID=Europe/Berlin:20120326T155200
37 DTEND;TZID=Europe/Berlin:20120326T165200
38 SUMMARY:original summary
39 TRANSP:OPAQUE
40 BEGIN:VALARM
41 ACTION:AUDIO
42 ATTACH;VALUE=URI:Basso
43 TRIGGER:PT0S
44 END:VALARM
45 END:VEVENT
46 END:VCALENDAR
47 ',
48  ],
49  ],
50  ];
51 
52  function testIssue205() {
53 
55  'REQUEST_METHOD' => 'REPORT',
56  'HTTP_CONTENT_TYPE' => 'application/xml',
57  'REQUEST_URI' => '/calendars/user1/calendar1',
58  'HTTP_DEPTH' => '1',
59  ]);
60 
61  $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
62 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
63  <D:prop>
64  <C:calendar-data>
65  <C:expand start="20120325T220000Z" end="20120401T215959Z"/>
66  </C:calendar-data>
67  <D:getetag/>
68  </D:prop>
69  <C:filter>
70  <C:comp-filter name="VCALENDAR">
71  <C:comp-filter name="VEVENT">
72  <C:comp-filter name="VALARM">
73  <C:time-range start="20120325T220000Z" end="20120401T215959Z"/>
74  </C:comp-filter>
75  </C:comp-filter>
76  </C:comp-filter>
77  </C:filter>
78 </C:calendar-query>');
79 
80  $response = $this->request($request);
81 
82  $this->assertFalse(strpos($response->body, '<s:exception>Exception</s:exception>'), 'Exception occurred: ' . $response->body);
83  $this->assertFalse(strpos($response->body, 'Unknown or bad format'), 'DateTime unknown format Exception: ' . $response->body);
84 
85  // Everts super awesome xml parser.
86  $body = substr(
87  $response->body,
88  $start = strpos($response->body, 'BEGIN:VCALENDAR'),
89  strpos($response->body, 'END:VCALENDAR') - $start + 13
90  );
91  $body = str_replace('&#13;', '', $body);
92 
93  $vObject = VObject\Reader::read($body);
94 
95  $this->assertEquals(1, count($vObject->VEVENT));
96 
97  }
98 }
foreach($paths as $path) $request
Definition: asyncclient.php:32
This unittest is created to check if a VALARM TRIGGER of PT0S is supported.
$start
Definition: bench.php:8
This class may be used as a basis for other webdav-related unittests.
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
$response