Exemple #1
0
 /** @test */
 public function should_create_role()
 {
     $this->assertInstanceOf('Cffs\\Domain\\Model\\Identity\\Role', $this->role);
     $this->assertEquals($this->id, $this->role->id());
     $this->assertEquals($this->title, $this->role->title());
     $this->assertEquals($this->slug, $this->role->slug());
 }
Exemple #2
0
 public static function create()
 {
     $faker = Factory::create();
     $identifier = RoleId::generate();
     $title = RoleTitle::fromNative($faker->word);
     $slug = RoleSlug::fromNative(Str::slug($title));
     return Role::define($identifier, $title, $slug);
 }
Exemple #3
0
 /**
  * Remove Role from User
  *
  * @param Role $role
  * @return void
  */
 public function revokeRole(Role $role)
 {
     $role->revokeRoleFromUser($this);
     $this->roles->removeElement($role);
     $this->record(new RoleWasRevoked($this));
 }