public function testSetRDates() { $rule = new Rule('FREQ=DAILY;COUNT=2', new \DateTime('2015-12-10')); $rDates = array(new DateInclusion(new \DateTime('2015-12-08'), false)); $rule->setRDates($rDates); $computed = $this->transformer->transform($rule); $this->assertCount(3, $computed); $this->assertEquals(new \DateTime('2015-12-10'), $computed[0]->getStart()); $this->assertEquals(new \DateTime('2015-12-11'), $computed[1]->getStart()); $this->assertEquals(new \DateTime('2015-12-08'), $computed[2]->getStart()); }
public function testGetString() { $this->rule->setFreq('YEARLY'); $this->rule->setCount(2); $this->rule->setInterval(2); $this->rule->setBySecond(array(30)); $this->rule->setByMinute(array(10)); $this->rule->setByHour(array(5, 15)); $this->rule->setByDay(array('SU', 'WE')); $this->rule->setByMonthDay(array(16, 22)); $this->rule->setByYearDay(array(201, 203)); $this->rule->setByWeekNumber(array(29, 32)); $this->rule->setByMonth(array(7, 8)); $this->rule->setBySetPosition(array(1, 3)); $this->rule->setWeekStart('TU'); $this->rule->setRDates(array('20151210', '20151214T020000Z', '20151215T210000')); $this->rule->setExDates(array('20140607', '20140620T010000Z', '20140620T010000')); $this->assertEquals('FREQ=YEARLY;COUNT=2;INTERVAL=2;BYSECOND=30;BYMINUTE=10;BYHOUR=5,15;BYDAY=SU,WE;BYMONTHDAY=16,22;BYYEARDAY=201,203;BYWEEKNO=29,32;BYMONTH=7,8;BYSETPOS=1,3;WKST=TU;RDATE=20151210,20151214T020000Z,20151215T210000;EXDATE=20140607,20140620T010000Z,20140620T010000', $this->rule->getString()); }