1<?php 2 3namespace Sabre\VObject\Recur\EventIterator; 4 5use Sabre\VObject\Recur; 6use Sabre\VObject\Reader; 7 8class FifthTuesdayProblemTest extends \PHPUnit_Framework_TestCase { 9 10 /** 11 * A pretty slow test. Had to be marked as 'medium' for phpunit to not die 12 * after 1 second. Would be good to optimize later. 13 * 14 * @medium 15 */ 16 function testGetDTEnd() { 17 18 $ics = <<<ICS 19BEGIN:VCALENDAR 20VERSION:2.0 21PRODID:-//Apple Inc.//iCal 4.0.4//EN 22CALSCALE:GREGORIAN 23BEGIN:VEVENT 24TRANSP:OPAQUE 25DTEND;TZID=America/New_York:20070925T170000 26UID:uuid 27DTSTAMP:19700101T000000Z 28LOCATION: 29DESCRIPTION: 30STATUS:CONFIRMED 31SEQUENCE:18 32SUMMARY:Stuff 33DTSTART;TZID=America/New_York:20070925T160000 34CREATED:20071004T144642Z 35RRULE:FREQ=MONTHLY;INTERVAL=1;UNTIL=20071030T035959Z;BYDAY=5TU 36END:VEVENT 37END:VCALENDAR 38ICS; 39 40 $vObject = Reader::read($ics); 41 $it = new Recur\EventIterator($vObject, (string)$vObject->VEVENT->UID); 42 43 while($it->valid()) { 44 $it->next(); 45 } 46 47 // If we got here, it means we were successful. The bug that was in the 48 // system before would fail on the 5th tuesday of the month, if the 5th 49 // tuesday did not exist. 50 $this->assertTrue(true); 51 52 } 53 54} 55