You are here

public function ContentHubUserSessionTest::testAuthenticatedRole in Acquia Content Hub 8

Test overridden methods.

Test overridden methods and constructor for an authenticated role.

@covers ::isAnonymous @covers ::isAuthenticated @covers ::__construct

File

tests/src/Unit/Session/ContentHubUserSessionTest.php, line 95

Class

ContentHubUserSessionTest
PHPUnit test for the ContentHubUserSession class.

Namespace

Drupal\Tests\acquia_contenthub\Unit\Session

Code

public function testAuthenticatedRole() {
  $render_account = new ContentHubUserSession(AccountInterface::AUTHENTICATED_ROLE);
  $this
    ->assertFalse($render_account
    ->isAnonymous());
  $this
    ->assertTrue($render_account
    ->isAuthenticated());
  $expected = [
    AccountInterface::AUTHENTICATED_ROLE,
  ];
  $this
    ->assertEquals($render_account
    ->getRoles(), $expected);
}