public function testOverriddenMonthlyDateEventRemoval()
 {
     $recurrenceFactory = new RecurrenceFactory();
     $recurrenceFactory->addRecurrenceType('monthly', 'Plummer\\Calendarful\\Recurrence\\Type\\MonthlyDate');
     $eventRegistry = m::mock('\\Plummer\\Calendarful\\Event\\EventRegistryInterface');
     $eventRegistry->shouldReceive('getEvents')->once()->andReturn(array(new MockEvent(2, '2014-08-31 18:00:00', '2014-08-31 19:00:00', 1, '2014-08-31 00:00:00')));
     $eventRegistry->shouldReceive('getRecurrentEvents')->once()->andReturn(array(new MockRecurrentEvent(1, '2014-05-31 00:00:00', '2014-05-31 01:00:00', null, null, 'monthly')));
     $calendar = Calendar::create($recurrenceFactory)->populate($eventRegistry, new \DateTime('2014-05-01 12:00:00'), new \DateTime('2014-10-31 20:00:00'));
     $overrideExists = false;
     $overriddenExists = false;
     $this->assertEquals(4, $calendar->count());
     foreach ($calendar as $event) {
         if ($event->getStartDate() == new \DateTime('2014-08-31 18:00:00')) {
             $overrideExists = true;
         } elseif ($event->getStartDate() == new \DateTime('2014-08-31 00:00:00')) {
             $overriddenExists = true;
         }
     }
     $this->assertTrue($overrideExists && !$overriddenExists);
 }
 public function testValidRecurrenceTypeClassRetrieval()
 {
     $recurrenceFactory = new RecurrenceFactory();
     $recurrenceFactory->addRecurrenceType('daily', new Daily());
     $this->assertInstanceOf('Plummer\\Calendarful\\Recurrence\\RecurrenceInterface', $recurrenceFactory->createRecurrenceType('daily'));
 }