Пример #1
0
 /** @test */
 function it_send_a_single_notification_having_the_category_(StoreNotification $storeNotification)
 {
     $infoNotification = ['category_id' => 1];
     $this->beConstructedWith($infoNotification);
     $storeNotification->storeSingle($infoNotification)->shouldBeCalled()->willReturn(new Notification());
     $this->send($storeNotification)->shouldReturnAnInstanceOf(Notification::class);
 }
Пример #2
0
 /**
  * Send group notifications.
  *
  * @param  StoreNotification $sender
  * @return mixed
  */
 public function send(StoreNotification $sender)
 {
     // Get group
     $group = $this->notifynderGroup->findByName($this->nameGroup);
     // Categories
     $categoriesAssociated = $group->categories;
     // Send a notification for each category
     foreach ($categoriesAssociated as $category) {
         // Category name
         $categoryModel = $this->notifynderCategory->findByName($category->name);
         $notification = array_merge(['category_id' => $categoryModel->id], $this->info);
         $sender->storeSingle($notification);
     }
     return $group;
 }
Пример #3
0
 /**
  * Send multiple notifications
  *
  * @param  StoreNotification $sender
  * @return mixed
  */
 public function send(StoreNotification $sender)
 {
     return $sender->storeMultiple($this->infoNotifications);
 }
Пример #4
0
 /** @test */
 function it_send_multiple_notification(StoreNotification $storeNotification)
 {
     $multiple = [];
     $storeNotification->storeMultiple($multiple)->shouldBeCalled()->willReturn(1);
     $this->send($storeNotification)->shouldReturn(1);
 }
Пример #5
0
 /**
  * Send Single notification.
  *
  * @param  StoreNotification $sender
  * @return mixed
  */
 public function send(StoreNotification $sender)
 {
     $this->hasCategory();
     return $sender->storeSingle($this->infoNotification);
 }