function WebTestBase::drupalGetAjax

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

core/modules/simpletest/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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.