protected function FrameworkTest::drupalGetAjax in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php \Drupal\Tests\system\Functional\Ajax\FrameworkTest::drupalGetAjax()
- 9 core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php \Drupal\Tests\system\Functional\Ajax\FrameworkTest::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.
3 calls to FrameworkTest::drupalGetAjax()
- FrameworkTest::testAJAXRender in core/
modules/ system/ tests/ src/ Functional/ Ajax/ FrameworkTest.php - Verifies the Ajax rendering of a command in the settings.
- FrameworkTest::testAJAXRenderError in core/
modules/ system/ tests/ src/ Functional/ Ajax/ FrameworkTest.php - Tests the behavior of an error alert command.
- FrameworkTest::testOrder in core/
modules/ system/ tests/ src/ Functional/ Ajax/ FrameworkTest.php - Tests AjaxResponse::prepare() AJAX commands ordering.
File
- core/
modules/ system/ tests/ src/ Functional/ Ajax/ FrameworkTest.php, line 149
Class
- FrameworkTest
- Performs tests on AJAX framework functions.
Namespace
Drupal\Tests\system\Functional\AjaxCode
protected function drupalGetAjax($path, array $options = [], array $headers = []) {
$headers[] = 'X-Requested-With: XMLHttpRequest';
if (!isset($options['query'][MainContentViewSubscriber::WRAPPER_FORMAT])) {
$options['query'][MainContentViewSubscriber::WRAPPER_FORMAT] = 'drupal_ajax';
}
return Json::decode($this
->drupalGet($path, $options, $headers));
}