public function ContentHubUserSessionTest::testAnonymousRole in Acquia Content Hub 8
Test overridden methods.
Test overridden methods and constructor for an anonymous role.
@covers ::isAnonymous @covers ::isAuthenticated @covers ::__construct
File
- tests/
src/ Unit/ Session/ ContentHubUserSessionTest.php, line 77
Class
- ContentHubUserSessionTest
- PHPUnit test for the ContentHubUserSession class.
Namespace
Drupal\Tests\acquia_contenthub\Unit\SessionCode
public function testAnonymousRole() {
$this->userRole = AccountInterface::ANONYMOUS_ROLE;
$render_account = new ContentHubUserSession(AccountInterface::ANONYMOUS_ROLE);
$this
->assertTrue($render_account
->isAnonymous());
$this
->assertFalse($render_account
->isAuthenticated());
$expected = [
AccountInterface::ANONYMOUS_ROLE,
];
$this
->assertEquals($render_account
->getRoles(), $expected);
}