Chris@0: adminUser = $this->drupalCreateUser([ Chris@0: 'administer blocks', Chris@0: 'administer themes', Chris@0: 'search content', Chris@0: ] Chris@0: ); Chris@0: Chris@0: $this->drupalLogin($this->adminUser); Chris@0: $this->drupalPlaceBlock('search_form_block'); Chris@0: $this->drupalPlaceBlock('local_tasks_block'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Tests that hidden regions do not inherit blocks when a theme is installed. Chris@0: */ Chris@0: public function testBlockNotInHiddenRegion() { Chris@0: Chris@0: // Ensure that the search form block is displayed. Chris@0: $this->drupalGet(''); Chris@0: $this->assertText('Search', 'Block was displayed on the front page.'); Chris@0: Chris@0: // Install "block_test_theme" and set it as the default theme. Chris@0: $theme = 'block_test_theme'; Chris@0: // We need to install a non-hidden theme so that there is more than one Chris@0: // local task. Chris@0: \Drupal::service('theme_handler')->install([$theme, 'stark']); Chris@0: $this->config('system.theme') Chris@0: ->set('default', $theme) Chris@0: ->save(); Chris@0: // Installing a theme will cause the kernel terminate event to rebuild the Chris@0: // router. Simulate that here. Chris@0: \Drupal::service('router.builder')->rebuildIfNeeded(); Chris@0: Chris@0: // Ensure that "block_test_theme" is set as the default theme. Chris@0: $this->drupalGet('admin/structure/block'); Chris@0: $this->assertText('Block test theme(' . t('active tab') . ')', 'Default local task on blocks admin page is the block test theme.'); Chris@0: Chris@0: // Ensure that the search form block is displayed. Chris@0: $this->drupalGet(''); Chris@0: $this->assertText('Search', 'Block was displayed on the front page.'); Chris@0: } Chris@0: Chris@0: }