public function __construct(UserRole $userRole) { $this->entity = $userRole; $this->entityDTO = new UserRoleDTO(); $this->setId(); $this->setTime(); $this->entityDTO->name = $this->entity->getName(); $this->entityDTO->description = $this->entity->getDescription(); }
public function testCreate() { $userRole = new UserRole(); $userRole->setName('Administrator'); $userRole->setDescription('Admin account with access to everything.'); $this->assertEntityValid($userRole); $this->assertSame('Administrator', $userRole->getName()); $this->assertSame('Admin account with access to everything.', $userRole->getDescription()); }
public function getUserRole() { $userRole = new UserRole(); $userRole->setName('Administrator'); $userRole->setDescription('Admin account. Access to everything'); return $userRole; }
public function testHasRoles() { $adminRole = new UserRole(); $adminRole->setName('admin'); $user = new User(); $user->addUserRole($adminRole); $this->assertTrue($user->hasUserRoles(['admin'])); $this->assertFalse($user->hasUserRoles(['developer'])); }