You are here

public function AnonymousUserSessionTest::testUserGetRoles in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 26
Contains \Drupal\Tests\Core\Session\AnonymousUserSessionTest.

Class

AnonymousUserSessionTest
@coversDefaultClass \Drupal\Core\Session\AnonymousUserSession @group Session

Namespace

Drupal\Tests\Core\Session

Code

public function testUserGetRoles() {
  $anonymous_user = new AnonymousUserSession();
  $this
    ->assertEquals(array(
    RoleInterface::ANONYMOUS_ID,
  ), $anonymous_user
    ->getRoles());
  $this
    ->assertEquals(array(), $anonymous_user
    ->getRoles(TRUE));
}