Mercurial > hg > rc1
comparison vendor/sabre/vobject/tests/VObject/Recur/EventIterator/FifthTuesdayProblemTest.php @ 7:430dbd5346f7
vendor sabre as distributed
| author | Charlie Root |
|---|---|
| date | Sat, 13 Jan 2018 09:06:10 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 6:cec75ba50afc | 7:430dbd5346f7 |
|---|---|
| 1 <?php | |
| 2 | |
| 3 namespace Sabre\VObject\Recur\EventIterator; | |
| 4 | |
| 5 use Sabre\VObject\Recur; | |
| 6 use Sabre\VObject\Reader; | |
| 7 | |
| 8 class 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 | |
| 19 BEGIN:VCALENDAR | |
| 20 VERSION:2.0 | |
| 21 PRODID:-//Apple Inc.//iCal 4.0.4//EN | |
| 22 CALSCALE:GREGORIAN | |
| 23 BEGIN:VEVENT | |
| 24 TRANSP:OPAQUE | |
| 25 DTEND;TZID=America/New_York:20070925T170000 | |
| 26 UID:uuid | |
| 27 DTSTAMP:19700101T000000Z | |
| 28 LOCATION: | |
| 29 DESCRIPTION: | |
| 30 STATUS:CONFIRMED | |
| 31 SEQUENCE:18 | |
| 32 SUMMARY:Stuff | |
| 33 DTSTART;TZID=America/New_York:20070925T160000 | |
| 34 CREATED:20071004T144642Z | |
| 35 RRULE:FREQ=MONTHLY;INTERVAL=1;UNTIL=20071030T035959Z;BYDAY=5TU | |
| 36 END:VEVENT | |
| 37 END:VCALENDAR | |
| 38 ICS; | |
| 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 } |
