Support from Acquia helps fund testing for Drupal Acquia logo

Comments

krishworks’s picture

 /**
   * Sets the raw HTML content. This can be useful when a page has been fetched
   * outside of the internal browser and assertions need to be made on the
   * returned page.
   *
   * A good example would be when testing drupal_http_request(). After fetching
   * the page the content can be set and page elements can be checked to ensure
   * that the function worked properly.
   */
  protected function drupalSetContent($content, $url = 'internal:') {
    $this->content = $content;
    $this->url = $url;
    $this->plainTextContent = FALSE;
    $this->elements = FALSE;
    $this->drupalSettings = array();
    if (preg_match('/var drupalSettings = (.*?);$/m', $content, $matches)) {
      $this->drupalSettings = drupal_json_decode($matches[1]);
    }
  }

The above code has a bit of documentation where drupal_http_request is being mentioned.

Can this

A good example would be when testing drupal_http_request().

be changed to

A good example would be when testing HTTP request made by Drupal. 
krishworks’s picture

Status: Active » Needs review
hello@melmcdougall.com’s picture

Assigned: Unassigned » hello@melmcdougall.com
FileSize
782 bytes

Sorry for taking an easy one. Despite leaving early myself, inspired by awesome efforts by those at DrupalCon Sydney today, to try to roll and submit my first patch. (Fingers crossed i've understood how this works...)

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. Yeah, I noticed later on when creating the meta issue that this is just a comment. Had planned to just roll it into the final patch that removes the function. But now there's a patch, so it can go in like this as well.

catch’s picture

Status: Reviewed & tested by the community » Fixed

OK. Committed/pushed to 8.x.

Status: Fixed » Closed (fixed)

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