You are here

AnonymousUserSessionTest.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Session/AnonymousUserSessionTest.php

File

core/tests/Drupal/Tests/Core/Session/AnonymousUserSessionTest.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Tests\Core\Session\AnonymousUserSessionTest.
 */
namespace Drupal\Tests\Core\Session;

use Drupal\Tests\UnitTestCase;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\user\RoleInterface;

/**
 * @coversDefaultClass \Drupal\Core\Session\AnonymousUserSession
 * @group Session
 */
class AnonymousUserSessionTest extends UnitTestCase {

  /**
   * Tests the method getRoles exclude or include locked roles based in param.
   *
   * @covers ::getRoles
   * @todo Move roles constants to a class/interface
   */
  public function testUserGetRoles() {
    $anonymous_user = new AnonymousUserSession();
    $this
      ->assertEquals(array(
      RoleInterface::ANONYMOUS_ID,
    ), $anonymous_user
      ->getRoles());
    $this
      ->assertEquals(array(), $anonymous_user
      ->getRoles(TRUE));
  }

}

Classes

Namesort descending Description
AnonymousUserSessionTest @coversDefaultClass \Drupal\Core\Session\AnonymousUserSession @group Session