Notifynder is a Facade Class that has all the methods necesessary to use the library. Notifynder allow you to have a flexible notification management. It will provide you a nice and easy API to store, retrieve and organise your notifications.
Inheritance: extends Fenos\Notifynder\Builder\NotifynderBuilder, implements Fenos\Notifynder\Notifynder
Ejemplo n.º 1
0
 /** @test */
 function it_store_extra_field_as_json()
 {
     $this->createCategory(['name' => 'custom']);
     $extra = ['notifynder' => 'amazing'];
     $notifications = $this->notifynder->category('custom')->extra($extra)->url('w')->from(1)->to(1);
     $notifications = $this->notifynder->send($notifications);
     $this->assertEquals(json_encode($extra), $notifications->extra);
 }
Ejemplo n.º 2
0
 /** @test */
 public function it_fire_a_notifynder_event(Dispatcher $dispatcher, NotifynderManager $notifynder)
 {
     $key = 'event';
     $category = 'hello';
     $extraValues = [];
     $notifyEvent = 'Notifynder.' . $key;
     $notificationBuilt = [0 => ['notification']];
     $notifynderEvent = new NotifynderEvent($notifyEvent, $category, $extraValues);
     $dispatcher->fire($notifyEvent, [$notifynderEvent, $notifynder])->shouldBeCalled()->willReturn($notificationBuilt);
     $notifynder->send($notificationBuilt[0])->shouldBeCalled()->willReturn(1);
     $this->fire($notifynder, $key, $category, $extraValues)->shouldReturn(1);
 }
Ejemplo n.º 3
0
 /**
  * It send multiple Notifications
  *
  * @method send
  * @group failing
  * @test
  */
 function it_send_multiple_notifications()
 {
     Factory::times(10)->create(User::class);
     $this->createCategory(['name' => 'me']);
     $allUsers = User::all();
     $this->notifynder->loop($allUsers, function ($builder, $user) {
         $builder->category('me')->url('you')->from(1)->to($user->id);
     })->send();
     // should send 10 notifications
     $notifications = Notification::all();
     $this->assertCount(10, $notifications);
 }
Ejemplo n.º 4
0
 /**
  * Test send multiple notifications from
  * the handler.
  *
  * @param NotifynderEvent $event
  * @param NotifynderManager      $notifynder
  * @return $this
  */
 public function userMultiple(NotifynderEvent $event, NotifynderManager $notifynder)
 {
     // Retrieve users
     $users = [1, 2];
     return $notifynder->builder()->loop($users, function (NotifynderBuilder $builder, $value, $key) {
         return $builder->category('activation')->url('hello')->from(1)->to($value);
     });
 }