You are here

public function UserSessionTest::testUserGetRoles in Zircon Profile 8

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

Class

UserSessionTest
@coversDefaultClass \Drupal\Core\Session\UserSession @group Session

Namespace

Drupal\Tests\Core\Session

Code

public function testUserGetRoles() {
  $this
    ->assertEquals(array(
    RoleInterface::AUTHENTICATED_ID,
    'role_two',
  ), $this->users['user_three']
    ->getRoles());
  $this
    ->assertEquals(array(
    'role_two',
  ), $this->users['user_three']
    ->getRoles(TRUE));
}