protected function WebTestBase::drupalGet in SimpleTest 8.3
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()
13 calls to WebTestBase::drupalGet()
- BrowserTest::testGetAbsoluteUrl in src/
Tests/ BrowserTest.php - Test \Drupal\simpletest\WebTestBase::getAbsoluteUrl().
- InstallerTestBase::visitInstaller in src/
InstallerTestBase.php - Visits the interactive installer.
- SimpleTestBrowserTest::testInternalBrowser in src/
Tests/ SimpleTestBrowserTest.php - Test the internal browsers functionality.
- SimpleTestBrowserTest::testUserAgentValidation in src/
Tests/ SimpleTestBrowserTest.php - Test validation of the User-Agent header we use to perform test requests.
- SimpleTestErrorCollectorTest::testErrorCollect in src/
Tests/ SimpleTestErrorCollectorTest.php - Tests that simpletest collects errors from the tested site.
File
- src/
WebTestBase.php, line 782
Class
- WebTestBase
- Test case for typical Drupal tests.
Namespace
Drupal\simpletestCode
protected function drupalGet($path, array $options = [], array $headers = []) {
// 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([
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
->setAbsolute()
->toString(TRUE)
->getGeneratedUrl();
}
$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;
}