コード例 #1
0
 public function testNeverEnds()
 {
     $event = new BasicEvent('My Event', 'Testing the new calendar', new \DateTime('2015-01-01 00:00:00'), new \DateTime('2015-01-01 23:59:59'));
     $event->repeats()->daily()->every(3)->forever();
     $this->assertEquals('Every 3 days', $event->getSchedule()->getSummary());
     $this->assertEquals(new \DateTime('2015-01-04'), $event->getSchedule()->nextOccurrence(new \DateTime('2015-01-01')));
     $this->assertEquals(new \DateTime('2016-01-02'), $event->getSchedule()->nextOccurrence(new \DateTime('2016-01-01')));
 }
コード例 #2
0
 public function testWithOn()
 {
     $event = new BasicEvent('My Event', 'Testing the new calendar', new \DateTime('2015-08-07'), new \DateTime('2015-08-07 23:59:59'));
     $event->repeats()->weekly()->on('Tuesday', 'Thursday')->forever();
     $this->assertEquals('Weekly, on Tuesday, Thursday', $event->getSchedule()->getSummary());
     $this->assertEquals(new \DateTime('2015-08-11'), $event->getSchedule()->nextOccurrence(new \DateTime('2015-04-07')));
     $this->assertEquals(new \DateTime('2015-08-13'), $event->getSchedule()->nextOccurrence(new \DateTime('2015-08-11')));
 }
コード例 #3
0
ファイル: QueryTest.php プロジェクト: aalexandru/calendar
 public function setUp()
 {
     $this->calendar = new Calendar('test');
     $event = new BasicEvent('My First Event', 'Testing the new calendar', new \DateTime('2015-03-05 00:00:00'), new \DateTime('2015-03-05 23:59:59'));
     $event->repeats()->daily()->every(2)->forever();
     $this->calendar->add($event);
     $this->events[] = $event;
     $event = new BasicEvent('My Second Event', 'Testing the new calendar', new \DateTime('2015-07-15 00:00:00'), new \DateTime('2015-07-15 23:59:59'));
     $event->repeats()->weekly()->endsAfter(2);
     $this->calendar->add($event);
     $this->events[] = $event;
     $event = new BasicEvent('My Third Event', 'Testing the new calendar', new \DateTime('2015-07-15 00:00:00'), new \DateTime('2015-07-15 23:59:59'));
     $event->repeats()->monthly()->endsOn(new \DateTime('2015-06-01'));
     $this->calendar->add($event);
     $this->events[] = $event;
 }