function UserSessionTest::testUserGetRoles
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Session/UserSessionTest.php \Drupal\Tests\Core\Session\UserSessionTest::testUserGetRoles()
- 10 core/tests/Drupal/Tests/Core/Session/UserSessionTest.php \Drupal\Tests\Core\Session\UserSessionTest::testUserGetRoles()
- 9 core/tests/Drupal/Tests/Core/Session/UserSessionTest.php \Drupal\Tests\Core\Session\UserSessionTest::testUserGetRoles()
- 8.9.x core/tests/Drupal/Tests/Core/Session/UserSessionTest.php \Drupal\Tests\Core\Session\UserSessionTest::testUserGetRoles()
Tests the method getRoles exclude or include locked roles based in param.
@todo Move roles constants to a class/interface @legacy-covers ::getRoles
File
-
core/
tests/ Drupal/ Tests/ Core/ Session/ UserSessionTest.php, line 64
Class
Namespace
Drupal\Tests\Core\SessionCode
public function testUserGetRoles() : void {
$user = $this->createUserSession([
'role_two',
], TRUE);
$this->assertEquals([
RoleInterface::AUTHENTICATED_ID,
'role_two',
], $user->getRoles());
$this->assertEquals([
'role_two',
], $user->getRoles(TRUE));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.