Пример #1
0
 /**
  * Label notification as unread.
  */
 public function testNotificationUnread()
 {
     $notification = $this->createNotification();
     // Set to read
     $this->assertTrue($notification->labelRead()->save());
     // Label unread
     $admin = $this->createSuperuser();
     $this->be($admin);
     $this->call('GET', route('notification.unread', ['notification' => $notification->id]));
     $this->assertResponseStatus(302);
     $notification = Notification::find(1);
     $this->assertFalse($notification->read);
     $this->assertNull($notification->read_at);
 }
Пример #2
0
 /**
  * Create a Notification from user1 to user2.
  *
  * @param VisualAppeal\Connect\User $user1 (Default: null, newly created)
  * @param VisualAppeal\Connect\User $user2 (Default: null, newly created)
  *
  * @return VisualAppeal\Connect\Notification
  */
 protected function createNotification($user1 = null, $user2 = null)
 {
     $user1 = $user1 ?: $this->createUser();
     $user2 = $user2 ?: $this->createuser();
     $notification = \VisualAppeal\Connect\Notification::create(['from_user_id' => $user1->id, 'to_user_id' => $user2->id, 'icon' => 'test', 'message' => 'notification.test', 'message_parameters' => ['user' => $user1->name], 'url' => '', 'url_parameters' => []]);
     return \VisualAppeal\Connect\Notification::find($notification->id);
 }