You are here

protected function DrupalWebTestCase::drupalGet in SimpleTest 7.2

Same name and namespace in other branches
  1. 6.2 drupal_web_test_case.php \DrupalWebTestCase::drupalGet()
  2. 7 drupal_web_test_case.php \DrupalWebTestCase::drupalGet()

Retrieves a Drupal path or an absolute path.

Parameters

$path: Drupal path or URL to load into internal browser

$options: Options to be forwarded to url().

$headers: An array containing additional HTTP request headers, each formatted as "name: value".

Return value

The retrieved HTML string, also available as $this->drupalGetContent()

11 calls to DrupalWebTestCase::drupalGet()
DrupalWebTestCase::checkForMetaRefresh in ./drupal_web_test_case.php
Check for meta refresh tag and if found call drupalGet() recursively. This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive.
DrupalWebTestCase::clickLink in ./drupal_web_test_case.php
Follows a link by name.
DrupalWebTestCase::cronRun in ./drupal_web_test_case.php
Runs cron in the Drupal installed by Simpletest.
DrupalWebTestCase::drupalGetAJAX in ./drupal_web_test_case.php
Retrieve a Drupal path or an absolute path and JSON decode the result.
DrupalWebTestCase::drupalLogout in ./drupal_web_test_case.php

... See full list

File

./drupal_web_test_case.php, line 1751
Provides DrupalTestCase, DrupalUnitTestCase, and DrupalWebTestCase classes.

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

protected function drupalGet($path, array $options = array(), array $headers = array()) {
  $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_NOBODY => FALSE,
    CURLOPT_HTTPHEADER => $headers,
  ));
  $this
    ->refreshVariables();

  // Ensure that any changes to variables in the other thread are picked up.
  // Replace original page output with new output from redirected page(s).
  if ($new = $this
    ->checkForMetaRefresh()) {
    $out = $new;
  }
  $this
    ->verbose('GET request to: ' . $path . '<hr />Ending URL: ' . $this
    ->getUrl() . '<hr />' . $out);
  return $out;
}