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();
 }
示例#2
0
 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());
 }
示例#3
0
 public function getUserRole()
 {
     $userRole = new UserRole();
     $userRole->setName('Administrator');
     $userRole->setDescription('Admin account. Access to everything');
     return $userRole;
 }
示例#4
0
 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']));
 }