You are here

function MenuAttributesTestBase::setUp in Menu Attributes 8

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

1 call to MenuAttributesTestBase::setUp()
MenuAttributesNodeTest::setUp in src/Tests/MenuAttributesNodeTest.php
Sets up a Drupal site for running functional and integration tests.
1 method overrides MenuAttributesTestBase::setUp()
MenuAttributesNodeTest::setUp in src/Tests/MenuAttributesNodeTest.php
Sets up a Drupal site for running functional and integration tests.

File

src/Tests/MenuAttributesTestBase.php, line 34

Class

MenuAttributesTestBase
Helper test class with some added functions for testing.

Namespace

Drupal\menu_attributes\Tests

Code

function setUp() {
  parent::setUp();
  $this
    ->drupalPlaceBlock('page_title_block');
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Page',
  ]);

  // Create users.
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer menu attributes',
    'access administration pages',
    'administer blocks',
    'administer menu',
    'administer content types',
  ]);
  $this->authenticatedUser = $this
    ->drupalCreateUser([]);
  $this->menu_attributes_new = [
    'title' => $this
      ->randomMachineName(10),
    'id' => $this
      ->randomMachineName(10),
    'name' => $this
      ->randomMachineName(10),
    'rel' => $this
      ->randomMachineName(10),
    'class' => $this
      ->randomMachineName(10),
    'style' => $this
      ->randomMachineName(10),
    'target' => '_top',
    'accesskey' => $this
      ->randomMachineName(1),
  ];
  $this->menu_attributes_edit = [
    'title' => $this
      ->randomMachineName(10),
    'id' => $this
      ->randomMachineName(10),
    'name' => $this
      ->randomMachineName(10),
    'rel' => $this
      ->randomMachineName(10),
    'class' => $this
      ->randomMachineName(10),
    'style' => $this
      ->randomMachineName(10),
    'target' => '_self',
    'accesskey' => $this
      ->randomMachineName(1),
  ];
}