ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ExpandEventsDoubleEventsTest.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 
19 
20  protected $setupCalDAV = true;
21 
22  protected $caldavCalendars = [
23  [
24  'id' => 1,
25  'name' => 'Calendar',
26  'principaluri' => 'principals/user1',
27  'uri' => 'calendar1',
28  ]
29  ];
30 
31  protected $caldavCalendarObjects = [
32  1 => [
33  'event.ics' => [
34  'calendardata' => 'BEGIN:VCALENDAR
35 VERSION:2.0
36 BEGIN:VEVENT
37 UID:foobar
38 DTEND;TZID=Europe/Berlin:20120207T191500
39 RRULE:FREQ=DAILY;INTERVAL=1;COUNT=3
40 SUMMARY:RecurringEvents 3 times
41 DTSTART;TZID=Europe/Berlin:20120207T181500
42 END:VEVENT
43 BEGIN:VEVENT
44 CREATED:20120207T111900Z
45 UID:foobar
46 DTEND;TZID=Europe/Berlin:20120208T191500
47 SUMMARY:RecurringEvents 3 times OVERWRITTEN
48 DTSTART;TZID=Europe/Berlin:20120208T181500
49 RECURRENCE-ID;TZID=Europe/Berlin:20120208T181500
50 END:VEVENT
51 END:VCALENDAR
52 ',
53  ],
54  ],
55  ];
56 
57  function testExpand() {
58 
60  'REQUEST_METHOD' => 'REPORT',
61  'HTTP_CONTENT_TYPE' => 'application/xml',
62  'REQUEST_URI' => '/calendars/user1/calendar1',
63  'HTTP_DEPTH' => '1',
64  ]);
65 
66  $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
67 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
68  <D:prop>
69  <C:calendar-data>
70  <C:expand start="20120205T230000Z" end="20120212T225959Z"/>
71  </C:calendar-data>
72  <D:getetag/>
73  </D:prop>
74  <C:filter>
75  <C:comp-filter name="VCALENDAR">
76  <C:comp-filter name="VEVENT">
77  <C:time-range start="20120205T230000Z" end="20120212T225959Z"/>
78  </C:comp-filter>
79  </C:comp-filter>
80  </C:filter>
81 </C:calendar-query>');
82 
83  $response = $this->request($request);
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  // We only expect 3 events
96  $this->assertEquals(3, count($vObject->VEVENT), 'We got 6 events instead of 3. Output: ' . $body);
97 
98  // TZID should be gone
99  $this->assertFalse(isset($vObject->VEVENT->DTSTART['TZID']));
100 
101  }
102 
103 }
foreach($paths as $path) $request
Definition: asyncclient.php:32
$start
Definition: bench.php:8
This class may be used as a basis for other webdav-related unittests.
This unittests is created to find out why certain events show up twice.
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