"Fossies" - the Fresh Open Source Software Archive

Member "dav-4.0.3/tests/Sabre/CalDAV/Issue220Test.php" (10 Jan 2020, 2871 Bytes) of package /linux/www/dav-4.0.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Issue220Test.php": 4.0.2_vs_4.0.3.

    1 <?php
    2 
    3 declare(strict_types=1);
    4 
    5 namespace Sabre\CalDAV;
    6 
    7 use Sabre\HTTP;
    8 
    9 /**
   10  * This unittest is created to check for an endless loop in CalendarQueryValidator.
   11  *
   12  * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
   13  * @author Evert Pot (http://evertpot.com/)
   14  * @license http://sabre.io/license/ Modified BSD License
   15  */
   16 class Issue220Test extends \Sabre\DAVServerTest
   17 {
   18     protected $setupCalDAV = true;
   19 
   20     protected $caldavCalendars = [
   21         [
   22             'id' => 1,
   23             'name' => 'Calendar',
   24             'principaluri' => 'principals/user1',
   25             'uri' => 'calendar1',
   26         ],
   27     ];
   28 
   29     protected $caldavCalendarObjects = [
   30         1 => [
   31             'event.ics' => [
   32                 'calendardata' => 'BEGIN:VCALENDAR
   33 VERSION:2.0
   34 BEGIN:VEVENT
   35 DTSTART;TZID=Europe/Berlin:20120601T180000
   36 SUMMARY:Brot backen
   37 RRULE:FREQ=DAILY;INTERVAL=1;WKST=MO
   38 TRANSP:OPAQUE
   39 DURATION:PT20M
   40 LAST-MODIFIED:20120601T064634Z
   41 CREATED:20120601T064634Z
   42 DTSTAMP:20120601T064634Z
   43 UID:b64f14c5-dccc-4eda-947f-bdb1f763fbcd
   44 BEGIN:VALARM
   45 TRIGGER;VALUE=DURATION:-PT5M
   46 ACTION:DISPLAY
   47 DESCRIPTION:Default Event Notification
   48 X-WR-ALARMUID:cd952c1b-b3d6-41fb-b0a6-ec3a1a5bdd58
   49 END:VALARM
   50 END:VEVENT
   51 BEGIN:VEVENT
   52 DTSTART;TZID=Europe/Berlin:20120606T180000
   53 SUMMARY:Brot backen
   54 TRANSP:OPAQUE
   55 STATUS:CANCELLED
   56 DTEND;TZID=Europe/Berlin:20120606T182000
   57 LAST-MODIFIED:20120605T094310Z
   58 SEQUENCE:1
   59 RECURRENCE-ID:20120606T160000Z
   60 UID:b64f14c5-dccc-4eda-947f-bdb1f763fbcd
   61 END:VEVENT
   62 END:VCALENDAR
   63 ',
   64             ],
   65         ],
   66     ];
   67 
   68     public function testIssue220()
   69     {
   70         $request = HTTP\Sapi::createFromServerArray([
   71             'REQUEST_METHOD' => 'REPORT',
   72             'HTTP_CONTENT_TYPE' => 'application/xml',
   73             'REQUEST_URI' => '/calendars/user1/calendar1',
   74             'HTTP_DEPTH' => '1',
   75         ]);
   76 
   77         $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
   78 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
   79     <D:prop>
   80         <C:calendar-data/>
   81         <D:getetag/>
   82     </D:prop>
   83     <C:filter>
   84         <C:comp-filter name="VCALENDAR">
   85             <C:comp-filter name="VEVENT">
   86                 <C:comp-filter name="VALARM">
   87                     <C:time-range start="20120607T161646Z" end="20120612T161646Z"/>
   88                 </C:comp-filter>
   89             </C:comp-filter>
   90         </C:comp-filter>
   91     </C:filter>
   92 </C:calendar-query>');
   93 
   94         $response = $this->request($request);
   95 
   96         $this->assertFalse(strpos($response->getBodyAsString(), '<s:exception>PHPUnit_Framework_Error_Warning</s:exception>'), 'Error Warning occurred: '.$response->getBodyAsString());
   97         $this->assertFalse(strpos($response->getBodyAsString(), 'Invalid argument supplied for foreach()'), 'Invalid argument supplied for foreach(): '.$response->getBodyAsString());
   98 
   99         $this->assertEquals(207, $response->status);
  100     }
  101 }