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