You are here

protected function TermAutocompleteTest::drupalGetJson in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php \Drupal\Tests\taxonomy\Functional\TermAutocompleteTest::drupalGetJson()

Helper function for JSON formatted requests.

Parameters

string|\Drupal\Core\Url $path: Drupal path or URL to load into Mink controlled browser.

array $options: (optional) Options to be forwarded to the url generator.

string[] $headers: (optional) An array containing additional HTTP request headers.

Return value

string[] Array representing decoded JSON response.

2 calls to TermAutocompleteTest::drupalGetJson()
TermAutocompleteTest::testAutocompleteCountResults in core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php
Tests that the autocomplete method returns the good number of results.
TermAutocompleteTest::testAutocompleteOrderedResults in core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php
Tests that the autocomplete method returns properly ordered results.

File

core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php, line 159

Class

TermAutocompleteTest
Tests the autocomplete implementation of the taxonomy class.

Namespace

Drupal\Tests\taxonomy\Functional

Code

protected function drupalGetJson($path, array $options = [], array $headers = []) {
  $options = array_merge_recursive([
    'query' => [
      '_format' => 'json',
    ],
  ], $options);
  return Json::decode($this
    ->drupalGet($path, $options, $headers));
}