function BlockTest::testThemeName

Same name in other branches
  1. 9 core/modules/block/tests/src/Functional/BlockTest.php \Drupal\Tests\block\Functional\BlockTest::testThemeName()
  2. 8.9.x core/modules/block/tests/src/Functional/BlockTest.php \Drupal\Tests\block\Functional\BlockTest::testThemeName()
  3. 10 core/modules/block/tests/src/Functional/BlockTest.php \Drupal\Tests\block\Functional\BlockTest::testThemeName()

Tests block display of theme titles.

File

core/modules/block/tests/src/Functional/BlockTest.php, line 328

Class

BlockTest
Tests basic block functionality.

Namespace

Drupal\Tests\block\Functional

Code

public function testThemeName() : void {
    // Enable the help block.
    $this->drupalPlaceBlock('help_block', [
        'region' => 'help',
    ]);
    $this->drupalPlaceBlock('local_tasks_block');
    // Explicitly set the default and admin themes.
    $theme = 'block_test_special_chars_theme';
    \Drupal::service('theme_installer')->install([
        $theme,
    ]);
    $this->drupalGet('admin/structure/block');
    $this->assertSession()
        ->assertEscaped('<"Cat" & \'Mouse\'>');
    $this->drupalGet('admin/structure/block/list/block_test_special_chars_theme');
    $this->assertSession()
        ->assertEscaped('Demonstrate block regions (<"Cat" & \'Mouse\'>)');
}

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