14 public $fixtures = array(
18 public function testAddRemoveNotificator()
21 $notificationManager->init();
23 $notificationManager->addNotificator(
'mailNotificator',
new MailNotificator());
24 $this->assertArrayHasKey(
'mailNotificator', $notificationManager->getNotificators());
26 $notificationManager->removeNotificator(
'mailNotificator');
27 $this->assertArrayNotHasKey(
'mailNotificator', $notificationManager->getNotificators());
29 $notificationManager->addNotificator(
'mailNotificator', array(
30 'class' =>
'MailNotificator'
32 $this->assertArrayHasKey(
'mailNotificator', $notificationManager->getNotificators());
35 public function testMailNotificator()
39 $mailNotificator = $this->getMock(
'MailNotificator', array(
'notify'));
41 ->expects($this->once())
43 $notificationManager->addNotificator(
'mailNotificator', $mailNotificator);
45 $notificationManager->notifyAbout(
new Notification(
'',
''));
48 public function testValidateRecipientSuccess()
52 $mailNotificator = $this->getMock(
'MailNotificator', array(
'createMail'));
54 ->expects($this->once())
55 ->method(
'createMail')
56 ->will($this->returnValue(
new PHPMailer()));
57 $notificationManager->addNotificator(
'mailNotificator', $mailNotificator);
63 public function testValidateRecipientFalse()
67 $mailNotificator = $this->getMock(
'MailNotificator', array(
'createMail'));
69 ->expects($this->never())
70 ->method(
'createMail')
71 ->will($this->returnValue(
new PHPMailer()));
72 $notificationManager->addNotificator(
'mailNotificator', $mailNotificator);
74 $notificationManager->notifyAbout(
new Notification(
'test',
'test', array(
new EmailRecipient($this->users[
'sample1'][
'email']))));