コード例 #1
0
 /**
  * It can send a notification to a User
  * @test
  */
 public function it_sends_notification_to_user()
 {
     $this->migrateDatabase();
     $this->createUser();
     $user = UserModel::first();
     $bus = app('Joselfonseca\\LaravelTactician\\CommandBusInterface');
     $bus->addHandler('Hechoenlaravel\\JarvisFoundation\\Notifications\\SendAppNotification\\SendAppNotificationCommand', 'Hechoenlaravel\\JarvisFoundation\\Notifications\\SendAppNotification\\Handler\\SendAppNotificationCommandHandler');
     $bus->dispatch('Hechoenlaravel\\JarvisFoundation\\Notifications\\SendAppNotification\\SendAppNotificationCommand', ['user' => $user, 'type' => 'success', 'message' => 'Some Message'], ['Hechoenlaravel\\JarvisFoundation\\Notifications\\SendAppNotification\\Middleware\\SetTheUserId']);
     $this->seeInDatabase('app_notifications', ['user_id' => $user->id, 'type' => 'success', 'message' => 'Some Message']);
 }
コード例 #2
0
 protected function createUser()
 {
     UserModel::create(['name' => 'test User', 'email' => '*****@*****.**', 'password' => '123456789', 'uuid' => '74927348972398472398']);
 }