? log.txt
? modules/simpletest/tests/343502.test
? modules/system/system.http.inc
Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.28
diff -u -p -r1.28 path.inc
--- includes/path.inc	14 Oct 2008 11:01:08 -0000	1.28
+++ includes/path.inc	6 Dec 2008 18:05:39 -0000
@@ -212,6 +212,7 @@ function drupal_set_title($title = NULL,
   if (isset($title)) {
     $stored_title = ($output == PASS_THROUGH) ? $title : check_plain($title);
   }
+
   return $stored_title;
 }
 
@@ -222,9 +223,15 @@ function drupal_set_title($title = NULL,
  *   Boolean value: TRUE if the current page is the front page; FALSE if otherwise.
  */
 function drupal_is_front_page() {
-  // As drupal_init_path updates $_GET['q'] with the 'site_frontpage' path,
-  // we can check it against the 'site_frontpage' variable.
-  return $_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node'));
+  static $is_front_page;
+
+  if (!isset($is_front_page)) {
+    // As drupal_init_path updates $_GET['q'] with the 'site_frontpage' path,
+    // we can check it against the 'site_frontpage' variable.
+    $is_front_page = ($_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node')));
+  }
+
+  return $is_front_page;
 }
 
 /**
Index: modules/simpletest/tests/path.test
===================================================================
RCS file: modules/simpletest/tests/path.test
diff -N modules/simpletest/tests/path.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/path.test	6 Dec 2008 18:05:56 -0000
@@ -0,0 +1,45 @@
+<?php
+// $Id$
+
+/**
+ * Test the common functions in path.inc.
+ */
+class DrupalCommonPathTest extends DrupalWebTestCase {
+
+  function getInfo() {
+    return array(
+      'name' => t('Common path functions'),
+      'description' => t("Performs tests on common path functions."),
+      'group' => t('Path'),
+    );
+  }
+
+  function setUp() {
+    parent::setUp('system_test');
+  }
+
+  /**
+   * Test drupal_is_front_page().
+   */
+  function testDrupalIsFrontPage() {
+    variable_set('drupal_is_front_page_output', 1);
+    $node = $this->drupalCreateNode(/*array('promote' => 1)*/);
+    $node_path = "node/" . $node->nid;
+
+    $this->drupalGet('node');
+    $this->assertText('drupal_is_front_page: TRUE', t('Path is the front page'));
+
+    $this->drupalGet($node_path);
+    $this->assertText('drupal_is_front_page: FALSE', t('Path is not the front page'));
+
+    variable_set('site_frontpage', $node_path);
+    $this->refreshVariables();
+    $this->assertEqual(variable_get('site_frontpage', 'node'), $node_path, t('Set front page path to %path', array('%path' => $node_path)));
+
+    $this->drupalGet('node');
+    $this->assertText('drupal_is_front_page: FALSE', t('Path is not the front page'));
+
+    $this->drupalGet($node_path);
+    $this->assertText('drupal_is_front_page: TRUE', t('Path is the front page'));
+  }
+}
Index: modules/simpletest/tests/system_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/system_test.module,v
retrieving revision 1.6
diff -u -p -r1.6 system_test.module
--- modules/simpletest/tests/system_test.module	22 Nov 2008 13:33:00 -0000	1.6
+++ modules/simpletest/tests/system_test.module	6 Dec 2008 18:05:56 -0000
@@ -150,6 +150,15 @@ function system_test_boot() {
 }
 
 /**
+ * Implementation of hook_init().
+ */
+function system_test_init() {
+  if (variable_get('drupal_is_front_page_output', 0)) {
+    drupal_set_message('drupal_is_front_page: ' . (drupal_is_front_page() ? 'TRUE' : 'FALSE'));
+  }
+}
+
+/**
  * Implementation of hook_exit().
  */
 function system_test_exit() {
