Exemple #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);
 }
Exemple #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);
 }
Exemple #3
0
 /**
  * Set the Role's id
  *
  * @param RoleId $id
  * @return void
  */
 private function setId(RoleId $id)
 {
     $this->id = $id->toString();
 }
Exemple #4
0
 /** @test */
 public function should_return_role_id_as_string()
 {
     $id = RoleId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc');
     $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', $id->toString());
     $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', (string) $id);
 }