From 31c48739aec497ed45ceb1bbf7cc8859c05d1ede Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole Date: Fri, 6 Dec 2013 10:51:51 +0000 Subject: [PATCH] Issue #2150083 by BarisW: Front page misses page title in tag. --- core/includes/theme.inc | 2 +- .../lib/Drupal/system/Tests/System/FrontPageTest.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/includes/theme.inc b/core/includes/theme.inc index bc01a15e3d8..726503e0223 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2128,7 +2128,7 @@ function template_preprocess_html(&$variables) { $site_config = \Drupal::config('system.site'); // Construct page title. - if (isset($variables['page']['#title'])) { + if (!empty($variables['page']['#title'])) { $head_title = array( 'title' => strip_tags($variables['page']['#title']), 'name' => String::checkPlain($site_config->get('name')), diff --git a/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php b/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php index 94fb323dd0e..336c2cbd7e0 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php @@ -19,7 +19,7 @@ class FrontPageTest extends WebTestBase { * * @var array */ - public static $modules = array('node', 'system_test'); + public static $modules = array('node', 'system_test', 'views'); public static function getInfo() { return array( @@ -46,8 +46,16 @@ class FrontPageTest extends WebTestBase { /** * Test front page functionality. */ - function testDrupalIsFrontPage() { + public function testDrupalFrontPage() { + // Create a promoted node to test the <title> tag on the front page view. + $settings = array( + 'title' => $this->randomName(8), + 'promote' => 1, + ); + $node = $this->drupalCreateNode($settings); $this->drupalGet(''); + $this->assertTitle('Home | Drupal'); + $this->assertText(t('On front page.'), 'Path is the front page.'); $this->drupalGet('node'); $this->assertText(t('On front page.'), 'Path is the front page.');