You are here

public function ThemeTest::testRegionClass in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testRegionClass()
  2. 9 core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testRegionClass()

Tests that region attributes can be manipulated via preprocess functions.

File

core/modules/system/tests/src/Functional/Theme/ThemeTest.php, line 160

Class

ThemeTest
Tests low-level theme functions.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testRegionClass() {
  \Drupal::service('module_installer')
    ->install([
    'block',
    'theme_region_test',
  ]);

  // Place a block.
  $this
    ->drupalPlaceBlock('system_main_block', [
    'region' => 'sidebar_first',
  ]);
  $this
    ->drupalGet('');
  $elements = $this
    ->cssSelect(".region-sidebar-first.new_class");
  $this
    ->assertCount(1, $elements, 'New class found.');
}