xref: /plugin/davcal/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\CalDAV;
4*a1a3b679SAndreas Boehleruse Sabre\HTTP;
5*a1a3b679SAndreas Boehler
6*a1a3b679SAndreas Boehler/**
7*a1a3b679SAndreas Boehler * This unittest is created to check if the time-range filter is working correctly with all-day-events
8*a1a3b679SAndreas Boehler *
9*a1a3b679SAndreas Boehler * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
10*a1a3b679SAndreas Boehler * @author Evert Pot (http://evertpot.com/)
11*a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License
12*a1a3b679SAndreas Boehler */
13*a1a3b679SAndreas Boehlerclass Issue228Test extends \Sabre\DAVServerTest {
14*a1a3b679SAndreas Boehler
15*a1a3b679SAndreas Boehler    protected $setupCalDAV = true;
16*a1a3b679SAndreas Boehler
17*a1a3b679SAndreas Boehler    protected $caldavCalendars = array(
18*a1a3b679SAndreas Boehler        array(
19*a1a3b679SAndreas Boehler            'id' => 1,
20*a1a3b679SAndreas Boehler            'name' => 'Calendar',
21*a1a3b679SAndreas Boehler            'principaluri' => 'principals/user1',
22*a1a3b679SAndreas Boehler            'uri' => 'calendar1',
23*a1a3b679SAndreas Boehler        )
24*a1a3b679SAndreas Boehler    );
25*a1a3b679SAndreas Boehler
26*a1a3b679SAndreas Boehler    protected $caldavCalendarObjects = array(
27*a1a3b679SAndreas Boehler        1 => array(
28*a1a3b679SAndreas Boehler            'event.ics' => array(
29*a1a3b679SAndreas Boehler                'calendardata' => 'BEGIN:VCALENDAR
30*a1a3b679SAndreas BoehlerVERSION:2.0
31*a1a3b679SAndreas BoehlerBEGIN:VEVENT
32*a1a3b679SAndreas BoehlerUID:20120730T113415CEST-6804EGphkd@xxxxxx.de
33*a1a3b679SAndreas BoehlerDTSTAMP:20120730T093415Z
34*a1a3b679SAndreas BoehlerDTSTART;VALUE=DATE:20120729
35*a1a3b679SAndreas BoehlerDTEND;VALUE=DATE:20120730
36*a1a3b679SAndreas BoehlerSUMMARY:sunday event
37*a1a3b679SAndreas BoehlerTRANSP:TRANSPARENT
38*a1a3b679SAndreas BoehlerEND:VEVENT
39*a1a3b679SAndreas BoehlerEND:VCALENDAR
40*a1a3b679SAndreas Boehler',
41*a1a3b679SAndreas Boehler            ),
42*a1a3b679SAndreas Boehler        ),
43*a1a3b679SAndreas Boehler    );
44*a1a3b679SAndreas Boehler
45*a1a3b679SAndreas Boehler    function testIssue228() {
46*a1a3b679SAndreas Boehler
47*a1a3b679SAndreas Boehler        $request = HTTP\Sapi::createFromServerArray(array(
48*a1a3b679SAndreas Boehler            'REQUEST_METHOD' => 'REPORT',
49*a1a3b679SAndreas Boehler            'HTTP_CONTENT_TYPE' => 'application/xml',
50*a1a3b679SAndreas Boehler            'REQUEST_URI' => '/calendars/user1/calendar1',
51*a1a3b679SAndreas Boehler            'HTTP_DEPTH' => '1',
52*a1a3b679SAndreas Boehler        ));
53*a1a3b679SAndreas Boehler
54*a1a3b679SAndreas Boehler        $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
55*a1a3b679SAndreas Boehler<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
56*a1a3b679SAndreas Boehler  <D:prop>
57*a1a3b679SAndreas Boehler    <C:calendar-data>
58*a1a3b679SAndreas Boehler  <C:expand start="20120730T095609Z"
59*a1a3b679SAndreas Boehler            end="20120813T095609Z"/>
60*a1a3b679SAndreas Boehler</C:calendar-data>
61*a1a3b679SAndreas Boehler    <D:getetag/>
62*a1a3b679SAndreas Boehler  </D:prop>
63*a1a3b679SAndreas Boehler  <C:filter>
64*a1a3b679SAndreas Boehler    <C:comp-filter name="VCALENDAR">
65*a1a3b679SAndreas Boehler      <C:comp-filter name="VEVENT">
66*a1a3b679SAndreas Boehler        <C:time-range start="20120730T095609Z" end="20120813T095609Z"/>
67*a1a3b679SAndreas Boehler      </C:comp-filter>
68*a1a3b679SAndreas Boehler    </C:comp-filter>
69*a1a3b679SAndreas Boehler  </C:filter>
70*a1a3b679SAndreas Boehler</C:calendar-query>');
71*a1a3b679SAndreas Boehler
72*a1a3b679SAndreas Boehler        $response = $this->request($request);
73*a1a3b679SAndreas Boehler
74*a1a3b679SAndreas Boehler        // We must check if absolutely nothing was returned from this query.
75*a1a3b679SAndreas Boehler        $this->assertFalse(strpos($response->body, 'BEGIN:VCALENDAR'));
76*a1a3b679SAndreas Boehler
77*a1a3b679SAndreas Boehler    }
78*a1a3b679SAndreas Boehler}
79