You are here

public function BlockUiTest::testBlockDemoUiPage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block/src/Tests/BlockUiTest.php \Drupal\block\Tests\BlockUiTest::testBlockDemoUiPage()

Test block demo page exists and functions correctly.

File

core/modules/block/src/Tests/BlockUiTest.php, line 83
Contains \Drupal\block\Tests\BlockUiTest.

Class

BlockUiTest
Tests that the block configuration UI exists and stores data correctly.

Namespace

Drupal\block\Tests

Code

public function testBlockDemoUiPage() {
  $this
    ->drupalPlaceBlock('help_block', array(
    'region' => 'help',
  ));
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->clickLink(t('Demonstrate block regions (@theme)', array(
    '@theme' => 'Classy',
  )));
  $elements = $this
    ->xpath('//div[contains(@class, "region-highlighted")]/div[contains(@class, "block-region") and contains(text(), :title)]', array(
    ':title' => 'Highlighted',
  ));
  $this
    ->assertTrue(!empty($elements), 'Block demo regions are shown.');
  \Drupal::service('theme_handler')
    ->install(array(
    'test_theme',
  ));
  $this
    ->drupalGet('admin/structure/block/demo/test_theme');
  $this
    ->assertEscaped('<strong>Test theme</strong>');
  \Drupal::service('theme_handler')
    ->install([
    'stable',
  ]);
  $this
    ->drupalGet('admin/structure/block/demo/stable');
  $this
    ->assertResponse(404, 'Hidden themes that are not the default theme are not supported by the block demo screen');
}