1<?php 2 3namespace Sabre\VObject\Property\ICalendar; 4 5use Sabre\VObject\Component\VCalendar; 6 7class RecurTest extends \PHPUnit_Framework_TestCase { 8 9 function testParts() { 10 11 $vcal = new VCalendar(); 12 $recur = $vcal->add('RRULE', 'FREQ=Daily'); 13 14 $this->assertInstanceOf('Sabre\VObject\Property\ICalendar\Recur', $recur); 15 16 $this->assertEquals(array('FREQ'=>'DAILY'), $recur->getParts()); 17 $recur->setParts(array('freq'=>'MONTHLY')); 18 19 $this->assertEquals(array('FREQ'=>'MONTHLY'), $recur->getParts()); 20 21 } 22 23 /** 24 * @expectedException \InvalidArgumentException 25 */ 26 function testSetValueBadVal() { 27 28 $vcal = new VCalendar(); 29 $recur = $vcal->add('RRULE', 'FREQ=Daily'); 30 $recur->setValue(new \Exception()); 31 32 } 33 34 function testSetSubParts() { 35 36 $vcal = new VCalendar(); 37 $recur = $vcal->add('RRULE', array('FREQ'=>'DAILY', 'BYDAY'=>'mo,tu', 'BYMONTH' => array(0,1))); 38 39 $this->assertEquals(array( 40 'FREQ'=>'DAILY', 41 'BYDAY' => array('MO','TU'), 42 'BYMONTH' => array(0,1), 43 ), $recur->getParts()); 44 45 } 46} 47