You are here

protected function HelpTopicTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/help_topics/tests/src/Functional/HelpTopicTest.php \Drupal\Tests\help_topics\Functional\HelpTopicTest::setUp()
  2. 10 core/modules/help_topics/tests/src/Functional/HelpTopicTest.php \Drupal\Tests\help_topics\Functional\HelpTopicTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/help_topics/tests/src/Functional/HelpTopicTest.php, line 57

Class

HelpTopicTest
Verifies help topic display and user access to help based on permissions.

Namespace

Drupal\Tests\help_topics\Functional

Code

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

  // These tests rely on some markup from the 'Seven' theme and we test theme
  // provided help topics.
  \Drupal::service('theme_installer')
    ->install([
    'seven',
    'help_topics_test_theme',
  ]);
  \Drupal::service('config.factory')
    ->getEditable('system.theme')
    ->set('admin', 'seven')
    ->save();

  // Place various blocks.
  $settings = [
    'theme' => 'seven',
    'region' => 'help',
  ];
  $this
    ->placeBlock('help_block', $settings);
  $this
    ->placeBlock('local_tasks_block', $settings);
  $this
    ->placeBlock('local_actions_block', $settings);
  $this
    ->placeBlock('page_title_block', $settings);
  $this
    ->placeBlock('system_breadcrumb_block', $settings);

  // Create users.
  $this->adminUser = $this
    ->createUser([
    'access administration pages',
    'view the administration theme',
    'administer permissions',
    'administer site configuration',
    'access test help',
  ]);
  $this->noTestUser = $this
    ->createUser([
    'access administration pages',
    'view the administration theme',
    'administer permissions',
    'administer site configuration',
  ]);
  $this->anyUser = $this
    ->createUser([]);
}