protected function WebTestBase::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 the url generator.

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

Return value

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

691 calls to WebTestBase::drupalGet()
AccessDeniedTest::testAccessDenied in drupal/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
AccessTest::testStaticAccessPlugin in drupal/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php
Tests static access check.
ActionUpgradePathTest::testActionUpgrade in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/ActionUpgradePathTest.php
Tests to see if actions were upgrade.
AddFeedTest::testAddFeed in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php
Creates and ensures that a feed is unique, checks source, and deletes feed.
AddFeedTest::testAddLongFeed in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php
Tests feeds with very long URLs.

... See full list

1 method overrides WebTestBase::drupalGet()
InstallerTest::drupalGet in drupal/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php
This override is necessary because the parent drupalGet() calls t(), which is not available early during installation.

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php, line 1222
Definition of Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

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.
  $url = $this->container
    ->get('url_generator')
    ->generateFromPath($path, $options);
  $out = $this
    ->curlExec(array(
    CURLOPT_HTTPGET => TRUE,
    CURLOPT_URL => $url,
    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;
  }
  $verbose = 'GET request to: ' . $path . '<hr />Ending URL: ' . $this
    ->getUrl();
  if ($this->dumpHeaders) {
    $verbose .= '<hr />Headers: <pre>' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>';
  }
  $verbose .= '<hr />' . $out;
  $this
    ->verbose($verbose);
  return $out;
}