You are here

protected function WebTestBase::drupalGet in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::drupalGet()

Retrieves a Drupal path or an absolute path.

Parameters

\Drupal\Core\Url|string $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

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

1131 calls to WebTestBase::drupalGet()
AccessDeniedTest::testAccessDenied in core/modules/system/src/Tests/System/AccessDeniedTest.php
AccessRoleTest::testAccessRole in core/modules/user/src/Tests/Views/AccessRoleTest.php
Tests role access plugin.
AccessTest::testStaticAccessPlugin in core/modules/views/src/Tests/Plugin/AccessTest.php
Tests static access check.
ActionUninstallTest::testActionUninstall in core/modules/action/src/Tests/ActionUninstallTest.php
Tests Action uninstall.
AddFeedTest::testAddFeed in core/modules/aggregator/src/Tests/AddFeedTest.php
Creates and ensures that a feed is unique, checks source, and deletes feed.

... See full list

1 method overrides WebTestBase::drupalGet()
UITestBase::drupalGet in core/modules/views_ui/src/Tests/UITestBase.php
Retrieves a Drupal path or an absolute path.

File

core/modules/simpletest/src/WebTestBase.php, line 1518
Contains \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()) {

  // 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 => $this
      ->buildUrl($path, $options),
    CURLOPT_NOBODY => FALSE,
    CURLOPT_HTTPHEADER => $headers,
  ));

  // Ensure that any changes to variables in the other thread are picked up.
  $this
    ->refreshVariables();

  // Replace original page output with new output from redirected page(s).
  if ($new = $this
    ->checkForMetaRefresh()) {
    $out = $new;

    // We are finished with all meta refresh redirects, so reset the counter.
    $this->metaRefreshCount = 0;
  }
  if ($path instanceof Url) {
    $path = $path
      ->toString();
  }
  $verbose = 'GET request to: ' . $path . '<hr />Ending URL: ' . $this
    ->getUrl();
  if ($this->dumpHeaders) {
    $verbose .= '<hr />Headers: <pre>' . Html::escape(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>';
  }
  $verbose .= '<hr />' . $out;
  $this
    ->verbose($verbose);
  return $out;
}