public function testSendEmailNotification()
 {
     $notification = new SystemNotification();
     $notification->Title = "Notify on event";
     $notification->Description = 'Notifies on an event occurring';
     $notification->NotificationText = 'This is a notfication to $Member.Email about $NotifyOnThis.Title';
     $notification->Identifier = 'NOTIFY_ON_EVENT';
     $notification->NotifyOnClass = 'NotifyOnThis';
     $notification->write();
     // okay, add it to our page
     $page = $this->objFromFixture('NotifyOnThis', 'not1');
     $ns = new NotificationService();
     Config::inst()->update('NotificationService', 'use_queues', false);
     Config::inst()->update('EmailNotificationSender', 'send_notifications_from', '*****@*****.**');
     Config::inst()->update('SystemNotification', 'default_template', false);
     $ns->setSenders(array('email' => 'EmailNotificationSender'));
     $ns->setChannels(array('email'));
     $ns->notify('NOTIFY_ON_EVENT', $page);
     // now check that there was an email sent
     $users = $page->getRecipients($notification->Identifier);
     $expectedTo = $users[0]->Email;
     $expectedFrom = '*****@*****.**';
     $expectedSubject = $notification->Title;
     $expectedBody = "This is a notfication to {$expectedTo} about {$page->Title}";
     $expectedBody = $notification->format(nl2br($expectedBody), $page);
     // TODO
     $this->assertEmailSent($expectedTo, $expectedFrom, $expectedSubject);
 }