From c1b5616cc236c7a65569e1fad039e62e64bfab6a Mon Sep 17 00:00:00 2001 From: webchick Date: Thu, 24 Nov 2011 13:41:11 -0800 Subject: Issue #1329914 by xjm, msonnabaum: Fixed Ensure ['q'] is set before calling drupal_normal_path(). --- modules/simpletest/tests/path.test | 8 ++++++++ modules/simpletest/tests/url_alter_test.module | 4 ++++ 2 files changed, 12 insertions(+) (limited to 'modules/simpletest') diff --git a/modules/simpletest/tests/path.test b/modules/simpletest/tests/path.test index 4998ffa38..8b3e6dc48 100644 --- a/modules/simpletest/tests/path.test +++ b/modules/simpletest/tests/path.test @@ -200,6 +200,14 @@ class UrlAlterFunctionalTest extends DrupalWebTestCase { $this->assertRaw('current_path=url-alter-test/foo', t('current_path() returns the internal path.')); } + /** + * Tests that $_GET['q'] is initialized when the request path is empty. + */ + function testGetQInitialized() { + $this->drupalGet(''); + $this->assertText("\$_GET['q'] is non-empty with an empty request path.", "\$_GET['q'] is initialized with an empty request path."); + } + /** * Assert that an outbound path is altered to an expected value. * diff --git a/modules/simpletest/tests/url_alter_test.module b/modules/simpletest/tests/url_alter_test.module index e229ab986..9287ff523 100644 --- a/modules/simpletest/tests/url_alter_test.module +++ b/modules/simpletest/tests/url_alter_test.module @@ -30,6 +30,10 @@ function url_alter_test_foo() { * Implements hook_url_inbound_alter(). */ function url_alter_test_url_inbound_alter(&$path, $original_path, $path_language) { + if (!request_path() && !empty($_GET['q'])) { + drupal_set_message("\$_GET['q'] is non-empty with an empty request path."); + } + // Rewrite user/username to user/uid. if (preg_match('!^user/([^/]+)(/.*)?!', $path, $matches)) { if ($account = user_load_by_name($matches[1])) { -- cgit v1.2.3