public function AnonymousUserSessionTest::testUserGetRoles in Drupal 8
Same name and namespace in other branches
- 9 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()
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));
}