public function getRoles()
{
return array( 'ROLE_USER' );
}
Alternatively, the roles might be stored on a roles property,
and populated in any number of different ways when the user object
is created. public getRoles ( ) : Role[] | ||
return | Role[] | The user roles |
public function testConstruct() { $login = '******'; $passwordHash = 'encoded_password'; $apiUser = $this->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\User\\User')->setConstructorArgs(array(array('login' => $login, 'passwordHash' => $passwordHash, 'enabled' => true)))->getMockForAbstractClass(); $roles = array('ROLE_USER'); $user = new User($apiUser, $roles); $this->assertSame($apiUser, $user->getAPIUser()); $this->assertSame($login, $user->getUsername()); $this->assertSame($passwordHash, $user->getPassword()); $this->assertSame($roles, $user->getRoles()); $this->assertNull($user->getSalt()); $this->assertTrue($user->isAccountNonExpired()); $this->assertTrue($user->isAccountNonLocked()); $this->assertTrue($user->isCredentialsNonExpired()); $this->assertTrue($user->isEnabled()); }