You are here

protected function MultiThemeTest::setUp in Style Switcher 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/MultiThemeTest.php \Drupal\Tests\styleswitcher\Functional\MultiThemeTest::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/Functional/MultiThemeTest.php, line 45

Class

MultiThemeTest
Tests with themes that have styleswitcher config.

Namespace

Drupal\Tests\styleswitcher\Functional

Code

protected function setUp() {
  parent::setUp();
  $this->themeStyles = [
    'styleswitcher_test_theme' => [
      'back' => [
        'Default',
        'Yellow on Purple',
        'Green text',
        'Blue back',
      ],
      'front' => [
        'Yellow on Purple',
        'Green text',
        'Blue back',
      ],
    ],
    'styleswitcher_test_base_theme' => [
      'back' => [
        'Default',
        'Yellow on Purple',
      ],
      'front' => [
        'Default',
        'Yellow on Purple',
      ],
    ],
    'stark' => [
      'back' => [
        'Default',
      ],
      'front' => [],
    ],
  ];
  $this
    ->enablePageCaching();
  $this
    ->drupalPlaceBlock('local_tasks_block', [
    'id' => 'local_tasks_block',
  ]);
  \Drupal::service('theme_installer')
    ->install(array_keys($this->themeStyles));

  // Place the Style Switcher block in each of themes.
  foreach (array_keys($this->themeStyles) as $theme) {
    $this
      ->drupalPlaceBlock('styleswitcher_styleswitcher', [
      'id' => 'styleswitcher_' . $theme,
      'theme' => $theme,
    ]);
  }
}