function ThemeTest::testRegionClass

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testRegionClass()
  2. 8.9.x core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testRegionClass()
  3. 10 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 161

Class

ThemeTest
Tests low-level theme functions.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testRegionClass() : void {
    \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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.