You are here

protected function SitemapMenuCustomTitleTest::setUp in Sitemap 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 SitemapMenuTestBase::setUp

File

src/Tests/SitemapMenuCustomTitleTest.php, line 22

Class

SitemapMenuCustomTitleTest
Test the display of menus based on sitemap settings.

Namespace

Drupal\sitemap\Tests

Code

protected function setUp() {
  parent::setUp();

  // Configure module to show main menu.
  $edit = [
    'show_menus[main]' => 'main',
  ];
  $this
    ->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));

  // Create test node with enabled menu item.
  $edit = [
    'title[0][value]' => $this
      ->randomString(),
    'menu[enabled]' => TRUE,
    'menu[title]' => $this
      ->randomString(),
    // In order to make main navigation menu displayed, there must be at least
    // one child menu item of that menu.
    'menu[menu_parent]' => 'main:',
  ];
  $this
    ->drupalPostForm('node/add/article', $edit, t('Save'));
}