public function BlockHiddenRegionTest::testBlockNotInHiddenRegion

Tests that hidden regions do not inherit blocks when a theme is enabled.

File

drupal/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php, line 55
Definition of Drupal\block\Tests\BlockHiddenRegionTest.

Class

BlockHiddenRegionTest
Tests that hidden regions do not inherit blocks when a theme is enabled.

Namespace

Drupal\block\Tests

Code

public function testBlockNotInHiddenRegion() {

  // Ensure that the search form block is displayed.
  $this
    ->drupalGet('');
  $this
    ->assertText('Search', 'Block was displayed on the front page.');

  // Enable "block_test_theme" and set it as the default theme.
  $theme = 'block_test_theme';
  theme_enable(array(
    $theme,
  ));
  config('system.theme')
    ->set('default', $theme)
    ->save();
  menu_router_rebuild();

  // Ensure that "block_test_theme" is set as the default theme.
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->assertText('Block test theme(' . t('active tab') . ')', 'Default local task on blocks admin page is the block test theme.');

  // Ensure that the search form block is displayed.
  $this
    ->drupalGet('');
  $this
    ->assertText('Search', 'Block was displayed on the front page.');
}