/** @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()); }
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); }
/** * 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)); }