.../Plugin/DisplayVariant/BlockPageVariantTest.php | 19 +++++++++---------- core/modules/help/src/Tests/HelpTest.php | 3 ++- .../modules/system/src/Tests/System/PageTitleTest.php | 8 ++++---- .../views/src/Tests/Plugin/DisabledDisplayTest.php | 4 ++-- core/modules/views_ui/src/Tests/HandlerTest.php | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php index bf01f41..0abab9a 100644 --- a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php +++ b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php @@ -99,7 +99,7 @@ public function providerBuild() { ); $test_cases = []; - $test_cases[] = [$blocks_config, 5, + $test_cases[] = [$blocks_config, 6, [ '#cache' => [ 'tags' => [ @@ -117,6 +117,7 @@ public function providerBuild() { 'center' => [ 'block4' => [], 'block5' => [], + 'block7' => [], '#sorted' => TRUE, ], 'bottom' => [ @@ -127,7 +128,7 @@ public function providerBuild() { ], ]; unset($blocks_config['block5']); - $test_cases[] = [$blocks_config, 4, + $test_cases[] = [$blocks_config, 5, [ '#cache' => [ 'tags' => [ @@ -143,6 +144,7 @@ public function providerBuild() { ], 'center' => [ 'block4' => [], + 'block7' => [], '#sorted' => TRUE, ], 'bottom' => [ @@ -157,16 +159,11 @@ public function providerBuild() { '#weight' => -1000, '#type' => 'status_messages', ], - 'page_title' => [ - '#markup' => 'Hi llamas!', - '#prefix' => '

', - '#suffix' => '

', - '#weight' => -900, - ], ], ], ]; unset($blocks_config['block4']); + unset($blocks_config['block7']); $test_cases[] = [$blocks_config, 3, [ '#cache' => [ @@ -195,10 +192,10 @@ public function providerBuild() { '#type' => 'status_messages', ], 'page_title' => [ - '#markup' => 'Hi cats!', '#prefix' => '

', '#suffix' => '

', '#weight' => -900, + '#markup' => 'Hi cats!', ], ], ], @@ -216,6 +213,7 @@ public function providerBuild() { public function testBuild(array $blocks_config, $visible_block_count, array $expected_render_array) { $display_variant = $this->setUpDisplayVariant(); $display_variant->setMainContent(['#markup' => 'Hello kittens!']); + $display_variant->setTitle('Hi cats!'); $blocks = ['top' => [], 'center' => [], 'bottom' => []]; $block_plugin = $this->getMock('Drupal\Core\Block\BlockPluginInterface'); @@ -256,6 +254,7 @@ public function testBuildWithoutMainContent() { $this->blockRepository->expects($this->once()) ->method('getVisibleBlocksPerRegion') ->willReturn([]); + $display_variant->setTitle('Hi llamas!'); $expected = [ '#cache' => [ @@ -272,10 +271,10 @@ public function testBuildWithoutMainContent() { '#type' => 'status_messages', ], 'page_title' => [ - '#markup' => '', '#prefix' => '

', '#suffix' => '

', '#weight' => -900, + '#markup' => 'Hi llamas!', ], ], ]; diff --git a/core/modules/help/src/Tests/HelpTest.php b/core/modules/help/src/Tests/HelpTest.php index 792eb9a..06b7312 100644 --- a/core/modules/help/src/Tests/HelpTest.php +++ b/core/modules/help/src/Tests/HelpTest.php @@ -107,7 +107,8 @@ protected function verifyHelp($response = 200) { $this->assertResponse($response); if ($response == 200) { $this->assertTitle($name . ' | Drupal', format_string('%module title was displayed', array('%module' => $module))); - $this->assertRaw('

' . t($name) . '

', format_string('%module heading was displayed', array('%module' => $module))); + $result = $this->xpath('//h1[@class="page-title"]'); + $this->assertEqual(t($name), trim((string)$result[0]), format_string('%module heading was displayed', array('%module' => $module))); $admin_tasks = system_get_module_admin_tasks($module, system_get_info('module', $module)); if (!empty($admin_tasks)) { $this->assertText(t('@module administration pages', array('@module' => $name))); diff --git a/core/modules/system/src/Tests/System/PageTitleTest.php b/core/modules/system/src/Tests/System/PageTitleTest.php index 44bd578..01f9f19 100644 --- a/core/modules/system/src/Tests/System/PageTitleTest.php +++ b/core/modules/system/src/Tests/System/PageTitleTest.php @@ -111,14 +111,14 @@ public function testRoutingTitle() { $this->drupalGet('test-render-title'); $this->assertTitle('Foo | Drupal'); - $result = $this->xpath('//h1'); + $result = $this->xpath('//main//h1'); $this->assertEqual('Foo', (string) $result[0]); // Test forms $this->drupalGet('form-test/object-builder'); $this->assertTitle('Test dynamic title | Drupal'); - $result = $this->xpath('//h1'); + $result = $this->xpath('//main//h1'); $this->assertEqual('Test dynamic title', (string) $result[0]); // Set some custom translated strings. @@ -131,14 +131,14 @@ public function testRoutingTitle() { $this->drupalGet('test-page-static-title'); $this->assertTitle('Static title translated | Drupal'); - $result = $this->xpath('//h1'); + $result = $this->xpath('//main//h1'); $this->assertEqual('Static title translated', (string) $result[0]); // Test the dynamic '_title_callback' route option. $this->drupalGet('test-page-dynamic-title'); $this->assertTitle('Dynamic title | Drupal'); - $result = $this->xpath('//h1'); + $result = $this->xpath('//main//h1'); $this->assertEqual('Dynamic title', (string) $result[0]); // Ensure that titles are cacheable and are escaped normally if the diff --git a/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php b/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php index 6f69411..b28d31b 100644 --- a/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php +++ b/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php @@ -60,7 +60,7 @@ public function testDisabledDisplays() { // Enabled page display should return content. $this->drupalGet('test-disabled-display'); - $result = $this->xpath('//h1'); + $result = $this->xpath('//main//h1'); $this->assertEqual($result[0], 'test_disabled_display', 'The enabled page_1 display is accessible.'); // Disabled page view should 404. @@ -79,7 +79,7 @@ public function testDisabledDisplays() { // Check that the originally disabled page_2 display is now enabled. $this->drupalGet('test-disabled-display-2'); - $result = $this->xpath('//h1'); + $result = $this->xpath('//main//h1'); $this->assertEqual($result[0], 'test_disabled_display', 'The enabled page_2 display is accessible.'); // Disable each disabled display and save the view. diff --git a/core/modules/views_ui/src/Tests/HandlerTest.php b/core/modules/views_ui/src/Tests/HandlerTest.php index e710454..2c3cfca 100644 --- a/core/modules/views_ui/src/Tests/HandlerTest.php +++ b/core/modules/views_ui/src/Tests/HandlerTest.php @@ -165,7 +165,7 @@ public function testBrokenHandlers() { $this->assertIdentical((string) $result[0], $text, 'Ensure the broken handler text was found.'); $this->drupalGet($href); - $result = $this->xpath('//h1'); + $result = $this->xpath('//main//h1'); $this->assertTrue(strpos((string) $result[0], $text) !== FALSE, 'Ensure the broken handler text was found.'); $original_configuration = [