Mercurial > hg > isophonics-drupal-site
comparison core/modules/block/tests/src/Functional/BlockHiddenRegionTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\block\Functional; | |
4 | |
5 use Drupal\Tests\BrowserTestBase; | |
6 | |
7 /** | |
8 * Tests that a newly installed theme does not inherit blocks to its hidden | |
9 * regions. | |
10 * | |
11 * @group block | |
12 */ | |
13 class BlockHiddenRegionTest extends BrowserTestBase { | |
14 | |
15 /** | |
16 * An administrative user to configure the test environment. | |
17 */ | |
18 protected $adminUser; | |
19 | |
20 /** | |
21 * Modules to install. | |
22 * | |
23 * @var array | |
24 */ | |
25 public static $modules = ['block', 'block_test', 'search']; | |
26 | |
27 protected function setUp() { | |
28 parent::setUp(); | |
29 | |
30 // Create administrative user. | |
31 $this->adminUser = $this->drupalCreateUser([ | |
32 'administer blocks', | |
33 'administer themes', | |
34 'search content', | |
35 ] | |
36 ); | |
37 | |
38 $this->drupalLogin($this->adminUser); | |
39 $this->drupalPlaceBlock('search_form_block'); | |
40 $this->drupalPlaceBlock('local_tasks_block'); | |
41 } | |
42 | |
43 /** | |
44 * Tests that hidden regions do not inherit blocks when a theme is installed. | |
45 */ | |
46 public function testBlockNotInHiddenRegion() { | |
47 | |
48 // Ensure that the search form block is displayed. | |
49 $this->drupalGet(''); | |
50 $this->assertText('Search', 'Block was displayed on the front page.'); | |
51 | |
52 // Install "block_test_theme" and set it as the default theme. | |
53 $theme = 'block_test_theme'; | |
54 // We need to install a non-hidden theme so that there is more than one | |
55 // local task. | |
56 \Drupal::service('theme_handler')->install([$theme, 'stark']); | |
57 $this->config('system.theme') | |
58 ->set('default', $theme) | |
59 ->save(); | |
60 // Installing a theme will cause the kernel terminate event to rebuild the | |
61 // router. Simulate that here. | |
62 \Drupal::service('router.builder')->rebuildIfNeeded(); | |
63 | |
64 // Ensure that "block_test_theme" is set as the default theme. | |
65 $this->drupalGet('admin/structure/block'); | |
66 $this->assertText('Block test theme(' . t('active tab') . ')', 'Default local task on blocks admin page is the block test theme.'); | |
67 | |
68 // Ensure that the search form block is displayed. | |
69 $this->drupalGet(''); | |
70 $this->assertText('Search', 'Block was displayed on the front page.'); | |
71 } | |
72 | |
73 } |