/**
  * get last notification for current user,
  * mark it as read and check the result.
  * Mark all as read
  *
  * @return void
  */
 protected function checkMarkingNotificationsAsRead()
 {
     $userId = \CB\User::getId();
     $n = $this->getLastNotification($userId);
     $this->assertTrue(!empty($n) && $n['read'] == '0', 'Last notification read or empty');
     $api = new \CB\Api\Notifications();
     //mark last notification as read
     $r = $api->markAsRead(array('ids' => $n['ids']));
     $this->assertTrue($r['success'] == true, 'Error marking notification as read.');
     //read the notification again and check the result
     $n = $this->getLastNotification($userId);
     $this->assertTrue(!empty($n) && $n['read'] == '1', 'Last notification not marked as read');
     //mark all as read
     $r = $api->markAllAsRead();
     $this->assertTrue($r['success'] == true, 'Error marking all notification as read.');
 }