aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php68
1 files changed, 27 insertions, 41 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php
index 6c9a09905..c3c97e8f6 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php
@@ -1,13 +1,13 @@
<?php
namespace Sabre\CalDAV;
+
use Sabre\HTTP;
-use Sabre\VObject;
/**
* This unittest is created to check if queries for time-range include the start timestamp or not
*
- * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
+ * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
@@ -15,24 +15,24 @@ class GetEventsByTimerangeTest extends \Sabre\DAVServerTest {
protected $setupCalDAV = true;
- protected $caldavCalendars = array(
- array(
- 'id' => 1,
- 'name' => 'Calendar',
+ protected $caldavCalendars = [
+ [
+ 'id' => 1,
+ 'name' => 'Calendar',
'principaluri' => 'principals/user1',
- 'uri' => 'calendar1',
- )
- );
+ 'uri' => 'calendar1',
+ ]
+ ];
- protected $caldavCalendarObjects = array(
- 1 => array(
- 'event.ics' => array(
+ protected $caldavCalendarObjects = [
+ 1 => [
+ 'event.ics' => [
'calendardata' => 'BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
CREATED:20120313T142342Z
UID:171EBEFC-C951-499D-B234-7BA7D677B45D
-DTEND;TZID=Europe/Berlin:20120227T000000
+DTEND;TZID=Europe/Berlin:20120227T010000
TRANSP:OPAQUE
SUMMARY:Monday 0h
DTSTART;TZID=Europe/Berlin:20120227T000000
@@ -41,31 +41,33 @@ SEQUENCE:4
END:VEVENT
END:VCALENDAR
',
- ),
- ),
- );
+ ],
+ ],
+ ];
function testQueryTimerange() {
- $request = new HTTP\Request(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'HTTP_CONTENT_TYPE' => 'application/xml',
- 'REQUEST_URI' => '/calendars/user1/calendar1',
- 'HTTP_DEPTH' => '1',
- ));
+ $request = new HTTP\Request(
+ 'REPORT',
+ '/calendars/user1/calendar1',
+ [
+ 'Content-Type' => 'application/xml',
+ 'Depth' => '1',
+ ]
+ );
$request->setBody('<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:prop>
<C:calendar-data>
- <C:expand start="20120226T230000Z" end="20120228T225959Z"/>
+ <C:expand start="20120226T220000Z" end="20120228T225959Z"/>
</C:calendar-data>
<D:getetag/>
</D:prop>
<C:filter>
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VEVENT">
- <C:time-range start="20120226T230000Z" end="20120228T225959Z"/>
+ <C:time-range start="20120226T220000Z" end="20120228T225959Z"/>
</C:comp-filter>
</C:comp-filter>
</C:filter>
@@ -73,24 +75,8 @@ END:VCALENDAR
$response = $this->request($request);
- if (strpos($response->body, 'BEGIN:VCALENDAR') === false) {
- $this->fail('Got no events instead of 1. Output: '.$response->body);
- }
-
- // Everts super awesome xml parser.
- $body = substr(
- $response->body,
- $start = strpos($response->body, 'BEGIN:VCALENDAR'),
- strpos($response->body, 'END:VCALENDAR') - $start + 13
- );
- $body = str_replace('&#13;','',$body);
-
- $vObject = VObject\Reader::read($body);
-
- // We expect 1 event
- $this->assertEquals(1, count($vObject->VEVENT), 'We got 0 events instead of 1. Output: ' . $body);
+ $this->assertTrue(strpos($response->body, 'BEGIN:VCALENDAR')!==false);
}
}
-