Example #1
0
 /**
  * @dataProvider dateTimeProvider
  */
 public function testIsOnDate($isOnDate, DateTime $dateTime, $isInRecurrences = null, $exception = null)
 {
     // Event duration is all the 2012 year
     $this->event->setStartDate(DateTime::createFromFormat('Y-m-d H:i:s', '2012-01-01 00:00:00'));
     $this->event->setEndDate(DateTime::createFromFormat('Y-m-d H:i:s', '2012-12-31 23:59:59'));
     if (null !== $isInRecurrences) {
         $recurrence = $this->getMockRecurrence();
         $recurrence->expects($this->once())->method("contains")->will($this->returnValue($isInRecurrences));
         $this->event->addRecurrence($recurrence);
     }
     if (null !== $exception) {
         $this->event->addException($exception);
     }
     $this->assertEquals($isOnDate, $this->event->isOnDate($dateTime));
 }