You are here

protected function WebTestBase::drupalGetXHR in Zircon Profile 8

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

Requests a Drupal path or an absolute path as if it is a XMLHttpRequest.

Parameters

\Drupal\Core\Url|string $path: Drupal path or URL to request from.

array $options: Array of URL options.

array $headers: Array of headers.

Return value

string The retrieved content.

2 calls to WebTestBase::drupalGetXHR()
DialogTest::testDialog in core/modules/system/src/Tests/Ajax/DialogTest.php
Test sending non-JS and AJAX requests to open and manipulate modals.
WebTestBase::drupalGetAjax in core/modules/simpletest/src/WebTestBase.php
Requests a path or URL in drupal_ajax format and JSON-decodes the response.

File

core/modules/simpletest/src/WebTestBase.php, line 1618
Contains \Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function drupalGetXHR($path, array $options = array(), array $headers = array()) {
  $headers[] = 'X-Requested-With: XMLHttpRequest';
  return $this
    ->drupalGet($path, $options, $headers);
}