You are here

public function BlockTest::testThemeName in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/block/tests/src/Functional/BlockTest.php \Drupal\Tests\block\Functional\BlockTest::testThemeName()

Test block display of theme titles.

File

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

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,
  ]);
  \Drupal::service('router.builder')
    ->rebuild();
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->assertEscaped('<"Cat" & \'Mouse\'>');
  $this
    ->drupalGet('admin/structure/block/list/block_test_specialchars_theme');
  $this
    ->assertEscaped('Demonstrate block regions (<"Cat" & \'Mouse\'>)');
}