function WebTestBase::drupalGetJSON

Retrieves a Drupal path or an absolute path and JSON decodes the result.

Parameters

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

array $options: Array of URL options.

array $headers: Array of headers. Eg array('Accept: application/vnd.drupal-ajax').

Return value

array Decoded json.

File

core/modules/simpletest/src/WebTestBase.php, line 825

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function drupalGetJSON($path, array $options = [], array $headers = []) {
    return Json::decode($this->drupalGetWithFormat($path, 'json', $options, $headers));
}

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