You are here

protected function WebTestBase::drupalGetJSON in SimpleTest 8.3

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

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));
}