summaryrefslogtreecommitdiff
path: root/modules/simpletest/drupal_web_test_case.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/drupal_web_test_case.php')
-rw-r--r--modules/simpletest/drupal_web_test_case.php29
1 files changed, 23 insertions, 6 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 1a49c9b5b..37c5964bc 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1005,7 +1005,7 @@ class DrupalWebTestCase extends DrupalTestCase {
// Make a request to the logout page, and redirect to the user page, the
// idea being if you were properly logged out you should be seeing a login
// screen.
- $this->drupalGet('user/logout', array('query' => 'destination=user'));
+ $this->drupalGet('user/logout', array('query' => array('destination' => 'user')));
$pass = $this->assertField('name', t('Username field found.'), t('Logout'));
$pass = $pass && $this->assertField('pass', t('Password field found.'), t('Logout'));
@@ -1779,7 +1779,7 @@ class DrupalWebTestCase extends DrupalTestCase {
$this->assertTrue(isset($urls[$index]), t('Clicked link %label (@url_target) from @url_before', array('%label' => $label, '@url_target' => $url_target, '@url_before' => $url_before)), t('Browser'));
- if (isset($urls[$index])) {
+ if (isset($url_target)) {
return $this->drupalGet($url_target);
}
return FALSE;
@@ -1793,12 +1793,16 @@ class DrupalWebTestCase extends DrupalTestCase {
* query, too. Can even be an absolute path which is just passed through.
* @return
* An absolute path.
+ *
+ * @todo What is the intention of this function? It is only invoked from
+ * locations, where URLs from the *output* are turned into absolute URLs,
+ * so why do we pass that through url() again?
*/
protected function getAbsoluteUrl($path) {
- $options = array('absolute' => TRUE);
$parts = parse_url($path);
- // This is more crude than the menu_is_external but enough here.
+ // This is more crude than menu_path_is_external() but enough here.
if (empty($parts['host'])) {
+ $options = array('absolute' => TRUE);
$path = $parts['path'];
$base_path = base_path();
$n = strlen($base_path);
@@ -1806,7 +1810,19 @@ class DrupalWebTestCase extends DrupalTestCase {
$path = substr($path, $n);
}
if (isset($parts['query'])) {
- $options['query'] = $parts['query'];
+ parse_str($parts['query'], $options['query']);
+ // Let's make it a bit more crude. It's not clear why we invoke url() on
+ // a URL contained in the returned page output again, but since $path is
+ // FALSE (see $path = $parts['path'] above) with Clean URLs disabled,
+ // and url() now encodes the passed in query parameter array, we get a
+ // double-encoded 'q' query string in the resulting absolute URL
+ // generated by url(). This cannot be avoided in url(). But it could be
+ // completely avoided if this function wouldn't be calling url().
+ // @see SimpleTestURLTestCase->testGetAbsoluteUrl()
+ if (isset($options['query']['q'])) {
+ $path = $options['query']['q'];
+ unset($options['query']['q']);
+ }
}
$path = url($path, $options);
}
@@ -2499,7 +2515,8 @@ class DrupalWebTestCase extends DrupalTestCase {
*/
protected function verbose($message) {
if ($id = simpletest_verbose($message)) {
- $this->pass(l(t('Verbose message'), $this->originalFileDirectory . '/simpletest/verbose/' . get_class($this) . '-' . $id . '.html', array('attributes' => array('target' => '_blank'))), 'Debug');
+ $url = file_create_url($this->originalFileDirectory . '/simpletest/verbose/' . get_class($this) . '-' . $id . '.html');
+ $this->pass(l(t('Verbose message'), $url, array('attributes' => array('target' => '_blank'))), 'Debug');
}
}