コード例 #1
0
 private function createNotificationsForEachToWhom()
 {
     try {
         foreach ($this->getToWhom() as $who) {
             $uuid = $this->generateNewId()->toString();
             $notify_builder = new NoticeCreateBuilder($to_id = $who, $to_type = $this->getToType(), $from_id = $this->getFrom(), $from_type = $this->getFromType(), $message_id = $this->getMessageId(), $category_id = $this->getCategory());
             $notify_builder->setId($uuid);
             $notice_made = Notify::create($notify_builder);
             $this->setNotificationsMade($notice_made);
         }
     } catch (\Exception $e) {
         throw new \Exception(sprintf("Error making notice for each person %s", $e->getMessage()));
     }
 }
コード例 #2
0
 /**
  * @test
  */
 public function should_get_10_unread_notifications_for_user()
 {
     $notifications = Notify::setRead(0)->setLimit(20)->setFromId('mock-project-1')->to('mock-user-1');
     $this->assertLessThan(20, count($notifications->toArray()));
     $this->assertGreaterThan(5, count($notifications->toArray()));
 }