public function testByHourWithVirtualLimit() { $rule = new Rule('FREQ=DAILY;BYHOUR=13', new \DateTime('2014-06-12 15:00:00')); $config = new ArrayTransformerConfig(); $config->setVirtualLimit(2); $this->transformer->setConfig($config); $computed = $this->transformer->transform($rule); $this->assertCount(2, $computed); $this->assertEquals(new \DateTime('2014-06-13 13:00:00'), $computed[0]->getStart()); $this->assertEquals(new \DateTime('2014-06-14 13:00:00'), $computed[1]->getStart()); }
public function testBySetPositionVirtualLimit() { $rule = new Rule('FREQ=MONTHLY;BYSETPOS=-1;BYDAY=MO,TU,WE,TH,FR', new \DateTime('2013-01-24')); $config = new ArrayTransformerConfig(); $config->setVirtualLimit(5); $this->transformer->setConfig($config); $computed = $this->transformer->transform($rule); $this->assertCount(5, $computed); $this->assertEquals(new \DateTime('2013-01-31'), $computed[0]->getStart()); $this->assertEquals(new \DateTime('2013-02-28'), $computed[1]->getStart()); $this->assertEquals(new \DateTime('2013-03-29'), $computed[2]->getStart()); $this->assertEquals(new \DateTime('2013-04-30'), $computed[3]->getStart()); $this->assertEquals(new \DateTime('2013-05-31'), $computed[4]->getStart()); }