/**
  * Test that only confirmed registrations get notified. Also test, if the ignoreNotifications
  * flag is evaluated
  *
  * @test
  * @return void
  */
 public function sendCustomNotificationReturnsExpectedAmountOfNotificationsSent()
 {
     $event = new \DERHANSEN\SfEventMgt\Domain\Model\Event();
     $registration1 = new \DERHANSEN\SfEventMgt\Domain\Model\Registration();
     $registration1->setConfirmed(FALSE);
     $registration2 = new \DERHANSEN\SfEventMgt\Domain\Model\Registration();
     $registration2->setConfirmed(TRUE);
     $registration3 = new \DERHANSEN\SfEventMgt\Domain\Model\Registration();
     $registration3->setConfirmed(TRUE);
     $registration4 = new \DERHANSEN\SfEventMgt\Domain\Model\Registration();
     $registration4->setConfirmed(TRUE);
     $registration4->setIgnoreNotifications(TRUE);
     /** @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registrations */
     $registrations = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $registrations->attach($registration1);
     $registrations->attach($registration2);
     $registrations->attach($registration3);
     $registrations->attach($registration4);
     $mockNotificationService = $this->getMock('DERHANSEN\\SfEventMgt\\Service\\NotificationService', array('sendUserMessage'));
     $mockNotificationService->expects($this->any())->method('sendUserMessage')->will($this->returnValue(TRUE));
     $registrationRepository = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Repository\\RegistrationRepository', array('findNotificationRegistrations'), array(), '', FALSE);
     $registrationRepository->expects($this->once())->method('findNotificationRegistrations')->will($this->returnValue($registrations));
     $this->inject($mockNotificationService, 'registrationRepository', $registrationRepository);
     $result = $mockNotificationService->sendCustomNotification($event, 'aTemplate', array('someSettings'));
     $this->assertEquals(2, $result);
 }