Exemplo n.º 1
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);
 }
Exemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     $this->id = RoleId::generate();
     $this->title = RoleTitle::fromNative('Asdf Qwerty');
     $this->slug = RoleSlug::fromNative(Str::slug($this->title->toString()));
     $this->role = Role::define($this->id, $this->title, $this->slug);
 }
 /** @test */
 public function should_throw_exception_user_does_not_have_permissions()
 {
     $role = $this->role;
     $user = $this->user;
     $user->shouldReceive('hasRole')->andReturn(false);
     $user->shouldReceive('id')->andReturn(UserId::generate());
     $role->shouldReceive('slug')->andReturn(RoleSlug::fromNative('asdf'));
     $this->setExpectedException(UserDoesNotHaveRolePermissions::class);
     $this->guard->handle(compact('user', 'role'));
 }
Exemplo n.º 4
0
 /** @test */
 public function should_create_from_native()
 {
     $role_title = RoleSlug::fromNative('fake-role-slug');
     $this->assertInstanceOf('Cffs\\Domain\\Model\\Identity\\RoleSlug', $role_title);
 }
Exemplo n.º 5
0
 /**
  * Set the Role's slug
  *
  * @param RoleSlug $slug
  * @return void
  */
 private function setSlug(RoleSlug $slug)
 {
     $this->slug = $slug->toString();
 }