Esempio 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);
 }
Esempio 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'));
 }
Esempio 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);
 }
Esempio n. 5
0
 /**
  * Set the Role's slug
  *
  * @param RoleSlug $slug
  * @return void
  */
 private function setSlug(RoleSlug $slug)
 {
     $this->slug = $slug->toString();
 }