function AnonymousUserSessionTest::testUserGetRoles
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Session/AnonymousUserSessionTest.php \Drupal\Tests\Core\Session\AnonymousUserSessionTest::testUserGetRoles()
- 10 core/tests/Drupal/Tests/Core/Session/AnonymousUserSessionTest.php \Drupal\Tests\Core\Session\AnonymousUserSessionTest::testUserGetRoles()
- 11.x core/tests/Drupal/Tests/Core/Session/AnonymousUserSessionTest.php \Drupal\Tests\Core\Session\AnonymousUserSessionTest::testUserGetRoles()
Tests the method getRoles exclude or include locked roles based in param.
@covers ::getRoles @todo Move roles constants to a class/interface
File
-
core/
tests/ Drupal/ Tests/ Core/ Session/ AnonymousUserSessionTest.php, line 21
Class
- AnonymousUserSessionTest
- @coversDefaultClass \Drupal\Core\Session\AnonymousUserSession @group Session
Namespace
Drupal\Tests\Core\SessionCode
public function testUserGetRoles() {
$anonymous_user = new AnonymousUserSession();
$this->assertEquals([
RoleInterface::ANONYMOUS_ID,
], $anonymous_user->getRoles());
$this->assertEquals([], $anonymous_user->getRoles(TRUE));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.