You are here

protected function ToolbarAdminMenuTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php \Drupal\toolbar\Tests\ToolbarAdminMenuTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides WebTestBase::setUp

File

core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php, line 63
Contains \Drupal\toolbar\Tests\ToolbarAdminMenuTest.

Class

ToolbarAdminMenuTest
Tests the caching of the admin menu subtree items.

Namespace

Drupal\toolbar\Tests

Code

protected function setUp() {
  parent::setUp();
  $perms = array(
    '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
    ->assertResponse(200);

  // Assert that the toolbar is present in the HTML.
  $this
    ->assertRaw('id="toolbar-administration"');

  // Store the adminUser admin menu subtrees hash for comparison later.
  $this->hash = $this
    ->getSubtreesHash();
}