diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php index fbb1383..c0b1739 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php @@ -161,8 +161,6 @@ function testMaintenancePage() { $html_attributes['dir'] = $language_interface->direction ? 'rtl' : 'ltr'; $site_config = \Drupal::config('system.site'); - $title = t('Maintenance Page Title'); - $head_title = strip_tags($title) . ' | ' . String::checkPlain($site_config->get('name')); // Add favicon. $favicon = theme_get_setting('favicon.url'); @@ -216,14 +214,14 @@ function testMaintenancePage() { $placeholders = array( '!html_attributes' => $html_attributes->__toString(), '!head' => drupal_get_html_head(), - '!head_title' => $head_title, + '!head_title' => $site_config->get('name'), '!styles' => drupal_get_css($css), '!scripts' => drupal_get_js(), '!attributes.class' => 'maintenance-page in-maintenance no-sidebars', '!front_page' => url(), '!logo' => theme_get_setting('logo.url'), '!site_name' => $site_config->get('name'), - '!title' => $title ? '

' . $title . '

' : '', + '!title' => '', '!content' => 'foo', ); @@ -231,6 +229,7 @@ function testMaintenancePage() { drupal_static_reset(); // Test basic string for maintenance page content. + // No page title is set, so it should default to the site name. $elements = array( array( 'name' => "#theme 'maintenance_page' with content of foo", @@ -238,9 +237,6 @@ function testMaintenancePage() { '#theme' => 'maintenance_page', '#content' => 'foo', '#show_messages' => FALSE, - '#page' => array( - '#title' => $title, - ), ), 'expected' => $expected, 'placeholders' => $placeholders, @@ -252,6 +248,11 @@ function testMaintenancePage() { drupal_static_reset(); $elements[0]['name'] = "#theme 'maintenance_page' with content as a render array"; $elements[0]['value']['#content'] = array('#markup' => 'foo'); + // Testing with a page title, which should be combined with the site name + $title = t('A non-empty title'); + $elements[0]['value']['#page']['#title'] = $title; + $elements[0]['placeholders']['!title'] = '

' . $title . '

'; + $elements[0]['placeholders']['!head_title'] = strip_tags($title) . ' | ' . String::checkPlain($site_config->get('name')); $this->assertElements($elements); } diff --git a/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php index 011e550..c290049 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php @@ -95,9 +95,8 @@ function testTitleXSS() { $this->drupalGet(''); // Test the title. - $this->assertNoRaw($title, 'Check for the unfiltered version of the title.'); - // Adding so we do not test the escaped version from drupal_set_title(). - $this->assertRaw($title_filtered . '', 'Check for the filtered version of the title.'); + $this->assertNoRaw($title, 'Check for the lack of the unfiltered version of the title.'); + $this->assertRaw('' . $title_filtered . '', 'Check for the filtered version of the title in a tag.'); // Test the slogan. $this->assertNoRaw($slogan, 'Check for the unfiltered version of the slogan.');