From work with testing.drupal.org and looking at some of the hax related to simpletest.test I think we need meta refresh support in the SimpleTest browser. In general this is needed to run any page using the batch API so it would most likely come in to more uses in the future.

The question is how to implement it.

  function drupalGet($path, $options = array(), $ = 10) {
    $options['absolute'] = TRUE;

    // We re-using a CURL connection here.  If that connection still has certain
    // options set, it might change the GET into a POST.  Make sure we clear out
    // previous options.
    $out = $this->curlExec(array(CURLOPT_HTTPGET => TRUE, CURLOPT_URL => url($path, $options), CURLOPT_HEADER => FALSE, CURLOPT_NOBODY => FALSE));
    $this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up.
    
    return $out;
  }

should I add something like:

if ($this->parse()) {
      $refresh = $this->xpath('//meta[@http-equiv="Refresh"]');
      if ($refresh) {
        // .... call drupalGet again or something?
      }
    }

and if so should I call drupalGet again? or somehow allow for support of meta refresh with delay longer then 0? or even allow test to see the page in the middle?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

boombatower’s picture

Title: Add meta refresh support to simpletest » Add meta refresh support to SimpleTest
boombatower’s picture

Status: Active » Needs review
FileSize
1.09 KB

Code like the following would do it, but I'm not sure this is what we want? Seems fine.

boombatower’s picture

Updated patch, that also removes hack related to simpletest.test with passes. :)

boombatower’s picture

Updated regex to allow for any or no whitespace instead of my [ ]+ space check...heh.

keith.smith’s picture

Status: Needs review » Needs work
Either the new page content of FALSE.

Minor, but huh? Maybe that "of" should be "or", perhaps?

boombatower’s picture

Status: Needs work » Needs review
FileSize
4.99 KB

chx:

* Named sub-pattern.
* Changed urldecode -> decode_entities.

boombatower’s picture

#5 fixed

chx’s picture

Status: Needs review » Reviewed & tested by the community

Good work!

c960657’s picture

Status: Reviewed & tested by the community » Needs work
+      $refresh = $this->xpath('//meta[@http-equiv="Refresh"]');

AFAICT this does a case-sensitive search for "Refresh", but the http-equiv attribute is case-insentive (according to the section 7.4.4 of the HTML spec).

boombatower’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
5.07 KB

This is how ugly it looks after adding that...since we are really just trying to support Drupal not sure if we want this.

$this->xpath('//meta[@http-equiv="Refresh"]');

turned into:

$this->xpath("//meta[contains(translate(@http-equiv,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'REFRESH')]");

plus made regex case insentive, but that was easy...just added modifier (i).

If not use #7.

Dries’s picture

Status: Reviewed & tested by the community » Needs work

Let's go with #7 but add a comment about how to use it (i.e. case-sensitive).

boombatower’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
5.09 KB

How about this.

boombatower’s picture

slight comment change.

boombatower’s picture

Added comments after webchick reviewed in IRC.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed! Thanks. :)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.