annotate vendor/sabre/vobject/tests/VObject/Property/ICalendar/RecurTest.php @ 7:430dbd5346f7

vendor sabre as distributed
author Charlie Root
date Sat, 13 Jan 2018 09:06:10 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
1 <?php
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
2
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
3 namespace Sabre\VObject\Property\ICalendar;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
4
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
5 use Sabre\VObject\Component\VCalendar;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
6
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
7 class RecurTest extends \PHPUnit_Framework_TestCase {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
8
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
9 function testParts() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
10
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
11 $vcal = new VCalendar();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
12 $recur = $vcal->add('RRULE', 'FREQ=Daily');
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
13
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
14 $this->assertInstanceOf('Sabre\VObject\Property\ICalendar\Recur', $recur);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
15
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
16 $this->assertEquals(array('FREQ'=>'DAILY'), $recur->getParts());
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
17 $recur->setParts(array('freq'=>'MONTHLY'));
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
18
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
19 $this->assertEquals(array('FREQ'=>'MONTHLY'), $recur->getParts());
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
20
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
21 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
22
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
23 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
24 * @expectedException \InvalidArgumentException
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
25 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
26 function testSetValueBadVal() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
27
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
28 $vcal = new VCalendar();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
29 $recur = $vcal->add('RRULE', 'FREQ=Daily');
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
30 $recur->setValue(new \Exception());
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
31
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
32 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
33
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
34 function testSetSubParts() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
35
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
36 $vcal = new VCalendar();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
37 $recur = $vcal->add('RRULE', array('FREQ'=>'DAILY', 'BYDAY'=>'mo,tu', 'BYMONTH' => array(0,1)));
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
38
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
39 $this->assertEquals(array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
40 'FREQ'=>'DAILY',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
41 'BYDAY' => array('MO','TU'),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
42 'BYMONTH' => array(0,1),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
43 ), $recur->getParts());
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
44
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
45 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
46 }