You are here

public function BlockTest::testThemeName in Drupal 9

Same name and namespace in other branches
  1. 8 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 296

Class

BlockTest
Tests basic block functionality.

Namespace

Drupal\Tests\block\Functional

Code

public function testThemeName() {

  // 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_specialchars_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_specialchars_theme');
  $this
    ->assertSession()
    ->assertEscaped('Demonstrate block regions (<"Cat" & \'Mouse\'>)');
}