function UserSessionTest::testUserGetRoles
Same name and namespace in other branches
- 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()
- 11.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.
@covers ::getRoles @todo Move roles constants to a class/interface
1 method overrides UserSessionTest::testUserGetRoles()
- UserTest::testUserGetRoles in core/
modules/ user/ tests/ src/ Unit/ Plugin/ Core/ Entity/ UserTest.php - Tests the method getRoles exclude or include locked roles based in param.
File
-
core/
tests/ Drupal/ Tests/ Core/ Session/ UserSessionTest.php, line 166
Class
- UserSessionTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Session%21UserSession.php/class/UserSession/10" title="An implementation of the user account interface for the global user." class="local">\Drupal\Core\Session\UserSession</a> @group Session
Namespace
Drupal\Tests\Core\SessionCode
public function testUserGetRoles() {
$this->assertEquals([
RoleInterface::AUTHENTICATED_ID,
'role_two',
], $this->users['user_three']
->getRoles());
$this->assertEquals([
'role_two',
], $this->users['user_three']
->getRoles(TRUE));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.