diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php index 2767b5f8d..9a3d47828 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php @@ -1,6 +1,7 @@ <?php namespace Sabre\CalDAV; + use Sabre\HTTP; use Sabre\VObject; @@ -8,7 +9,7 @@ use Sabre\VObject; * This unittests is created to find out why recurring events have wrong DTSTART value * * - * @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 */ @@ -16,18 +17,18 @@ class ExpandEventsDTSTARTandDTENDTest 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 @@ -47,18 +48,18 @@ RECURRENCE-ID;TZID=Europe/Berlin:20120208T181500 END:VEVENT END:VCALENDAR ', - ), - ), - ); + ], + ], + ]; function testExpand() { - $request = new HTTP\Request(array( - 'REQUEST_METHOD' => 'REPORT', + $request = HTTP\Sapi::createFromServerArray([ + 'REQUEST_METHOD' => 'REPORT', 'HTTP_CONTENT_TYPE' => 'application/xml', - 'REQUEST_URI' => '/calendars/user1/calendar1', - 'HTTP_DEPTH' => '1', - )); + 'REQUEST_URI' => '/calendars/user1/calendar1', + 'HTTP_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"> @@ -85,26 +86,28 @@ END:VCALENDAR $start = strpos($response->body, 'BEGIN:VCALENDAR'), strpos($response->body, 'END:VCALENDAR') - $start + 13 ); - $body = str_replace(' ','',$body); + $body = str_replace(' ', '', $body); - $vObject = VObject\Reader::read($body); + try { + $vObject = VObject\Reader::read($body); + } catch (VObject\ParseException $e) { + $this->fail('Could not parse object. Error:' . $e->getMessage() . ' full object: ' . $response->getBodyAsString()); + } // check if DTSTARTs and DTENDs are correct foreach ($vObject->VEVENT as $vevent) { /** @var $vevent Sabre\VObject\Component\VEvent */ - foreach ($vevent->children as $child) { + foreach ($vevent->children() as $child) { /** @var $child Sabre\VObject\Property */ - if ($child->name == 'DTSTART') { // DTSTART has to be one of three valid values - $this->assertContains($child->getValue(), array('20120207T171500Z', '20120208T171500Z', '20120209T171500Z'), 'DTSTART is not a valid value: '.$child->getValue()); + $this->assertContains($child->getValue(), ['20120207T171500Z', '20120208T171500Z', '20120209T171500Z'], 'DTSTART is not a valid value: ' . $child->getValue()); } elseif ($child->name == 'DTEND') { // DTEND has to be one of three valid values - $this->assertContains($child->getValue(), array('20120207T181500Z', '20120208T181500Z', '20120209T181500Z'), 'DTEND is not a valid value: '.$child->getValue()); + $this->assertContains($child->getValue(), ['20120207T181500Z', '20120208T181500Z', '20120209T181500Z'], 'DTEND is not a valid value: ' . $child->getValue()); } } } } } - |