1<?php 2 3namespace Sabre\VObject\Recur; 4 5use 6 Sabre\VObject\Reader, 7 DateTime; 8 9class ByMonthInDailyTest extends \PHPUnit_Framework_TestCase { 10 11 /** 12 * This tests the expansion of dates with DAILY frequency in RRULE with BYMONTH restrictions 13 */ 14 function testExpand() { 15 16 $ics = <<<ICS 17BEGIN:VCALENDAR 18VERSION:2.0 19PRODID:-//Apple Inc.//iCal 4.0.4//EN 20CALSCALE:GREGORIAN 21BEGIN:VEVENT 22TRANSP:OPAQUE 23DTEND:20070925T183000Z 24UID:uuid 25DTSTAMP:19700101T000000Z 26LOCATION: 27DESCRIPTION: 28STATUS:CONFIRMED 29SEQUENCE:18 30SUMMARY:Stuff 31DTSTART:20070925T160000Z 32CREATED:20071004T144642Z 33RRULE:FREQ=DAILY;BYMONTH=9,10;BYDAY=SU 34END:VEVENT 35END:VCALENDAR 36ICS; 37 38 $vcal = Reader::read($ics); 39 $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal); 40 41 $vcal->expand(new DateTime('2013-09-28'), new DateTime('2014-09-11')); 42 43 foreach ($vcal->VEVENT as $event) { 44 $dates[] = $event->DTSTART->getValue(); 45 } 46 47 $expectedDates = array( 48 "20130929T160000Z", 49 "20131006T160000Z", 50 "20131013T160000Z", 51 "20131020T160000Z", 52 "20131027T160000Z", 53 "20140907T160000Z" 54 ); 55 56 $this->assertEquals($expectedDates, $dates, 'Recursed dates are restricted by month'); 57 } 58 59} 60