protected function ToolbarAdminMenuTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::setUp()
Overrides BrowserTestBase::setUp
File
- core/
modules/ toolbar/ tests/ src/ Functional/ ToolbarAdminMenuTest.php, line 75
Class
- ToolbarAdminMenuTest
- Tests the caching of the admin menu subtree items.
Namespace
Drupal\Tests\toolbar\FunctionalCode
protected function setUp() : void {
parent::setUp();
$perms = [
'access toolbar',
'access administration pages',
'administer site configuration',
'bypass node access',
'administer themes',
'administer nodes',
'access content overview',
'administer blocks',
'administer menu',
'administer modules',
'administer permissions',
'administer users',
'access user profiles',
'administer taxonomy',
'administer languages',
'translate interface',
];
// Create an administrative user and log it in.
$this->adminUser = $this
->drupalCreateUser($perms);
$this->adminUser2 = $this
->drupalCreateUser($perms);
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('test-page');
$this
->assertSession()
->statusCodeEquals(200);
// Assert that the toolbar is present in the HTML.
$this
->assertSession()
->responseContains('id="toolbar-administration"');
// Store the adminUser admin menu subtrees hash for comparison later.
$this->hash = $this
->getSubtreesHash();
}