You are here

protected function WebTestBase::drupalGetAjax in SimpleTest 8.3

Requests a path or URL in drupal_ajax format and JSON-decodes the response.

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

array Decoded JSON.

File

src/WebTestBase.php, line 862

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function drupalGetAjax($path, array $options = [], array $headers = []) {
  if (!isset($options['query'][MainContentViewSubscriber::WRAPPER_FORMAT])) {
    $options['query'][MainContentViewSubscriber::WRAPPER_FORMAT] = 'drupal_ajax';
  }
  return Json::decode($this
    ->drupalGetXHR($path, $options, $headers));
}