function AdminAccountSwitcherTest::testSuperUser
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/DefaultContent/AdminAccountSwitcherTest.php \Drupal\KernelTests\Core\DefaultContent\AdminAccountSwitcherTest::testSuperUser()
Tests switching to user 1 when the superuser access policy is enabled.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ DefaultContent/ AdminAccountSwitcherTest.php, line 71
Class
- AdminAccountSwitcherTest
- @covers \Drupal\Core\DefaultContent\AdminAccountSwitcher @group DefaultContent
Namespace
Drupal\KernelTests\Core\DefaultContentCode
public function testSuperUser() : void {
/** @var \Drupal\Core\Session\AccountInterface $account */
$account = $this->createUser();
$this->assertSame(1, (int) $account->id());
$switcher = new AdminAccountSwitcher($this->container
->get(AccountSwitcherInterface::class), $this->container
->get(EntityTypeManagerInterface::class), TRUE);
$this->assertSame(1, (int) $switcher->switchToAdministrator()
->id());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.