1<?php 2 3namespace Sabre\VObject\Recur\EventIterator; 4 5use DateTime; 6use Sabre\VObject\Reader; 7use Sabre\VObject\Settings; 8 9class MaxInstancesTest extends \PHPUnit_Framework_TestCase { 10 11 /** 12 * @expectedException \Sabre\VObject\Recur\MaxInstancesExceededException 13 */ 14 function testExceedMaxRecurrences() { 15 16 $input = <<<ICS 17BEGIN:VCALENDAR 18VERSION:2.0 19BEGIN:VEVENT 20UID:foobar 21DTSTART:20140803T120000Z 22RRULE:FREQ=WEEKLY 23SUMMARY:Original 24END:VEVENT 25END:VCALENDAR 26ICS; 27 28 $temp = Settings::$maxRecurrences; 29 Settings::$maxRecurrences = 4; 30 try { 31 32 $vcal = Reader::read($input); 33 $vcal->expand(new DateTime('2014-08-01'), new DateTime('2014-09-01')); 34 35 } finally { 36 Settings::$maxRecurrences = $temp; 37 } 38 39 } 40 41} 42