/**
  * @covers ::getRecipients
  */
 public function testGetRecipients()
 {
     $mockdb = new \TMT\MockDB();
     $mockdb->expectPrepare("SELECT notifications.*, userNotifications.netId, userNotifications.read FROM notifications JOIN userNotifications\n\t\t\tON notifications.guid=userNotifications.notificationGuid WHERE notifications.guid=:guid AND userNotifications.deleted=0");
     $mockdb->expectExecute(array(':guid' => "guid1"));
     $mockdb->setReturnData(array((object) array("guid" => "guid1", "netId" => "netId1", "timestamp" => "2000-01-01 00:00:00", "message" => "message", "area" => "areaguid", "type" => "type1", "read" => "0"), (object) array("guid" => "guid1", "netId" => "netId2", "timestamp" => "2000-01-01 00:00:00", "message" => "message", "area" => "areaguid", "type" => "type1", "read" => "1")));
     $expected = array(new \TMT\model\UserNotification(array("guid" => "guid1", "netId" => "netId1", "timestamp" => "2000-01-01 00:00:00", "message" => "message", "area" => "areaguid", "type" => "type1", "read" => "0")), new \TMT\model\UserNotification(array("guid" => "guid1", "netId" => "netId2", "timestamp" => "2000-01-01 00:00:00", "message" => "message", "area" => "areaguid", "type" => "type1", "read" => "1")));
     $accessor = new UserNotification($mockdb);
     $actual = $accessor->getRecipients("guid1");
     $this->assertEquals($expected, $actual);
     $mockdb->verify();
 }
 /**
  * Send a notification via email to the selected users
  *
  * @param UserNotification $notification
  * @param array $data
  */
 public function sendNotification($notification, $context, $data)
 {
     $users = $notification->getRecipients($context);
     foreach ($users as $user) {
         $this->sendToUser($notification, $context, $user, $data);
     }
 }