public function test_can_create_role()
 {
     $this->createUser();
     $this->createRoles();
     $this->assertCount(3, $this->app->make(RoleRepositoryInterface::class)->all());
     $this->app->make(UserRepositoryInterface::class)->addRoles(1, [1, 2, 3]);
     $this->assertCount(3, User::find(1)->roles);
     $this->assertCount(1, Role::find(1)->users);
     $this->assertTrue(User::find(1)->isAdmin());
 }
Exemple #2
0
 public function test_can_restore_rows_from_deleted()
 {
     $user = User::create(['name' => 'User Test', 'email' => '*****@*****.**', 'password' => '123456']);
     $user->delete();
     $user->restore();
     $user = User::find(1);
     $this->assertEquals(1, $user->id);
     $this->assertEquals('User Test', $user->name);
 }