You are here

protected function WebTestBase::drupalGetAjax in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\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.

8 calls to WebTestBase::drupalGetAjax()
DialogTest::testDialog in core/modules/system/src/Tests/Ajax/DialogTest.php
Test sending non-JS and AJAX requests to open and manipulate modals.
FrameworkTest::testAJAXRender in core/modules/system/src/Tests/Ajax/FrameworkTest.php
Ensures \Drupal\Core\Ajax\AjaxResponse::ajaxRender() returns JavaScript settings from the page request.
FrameworkTest::testAJAXRenderError in core/modules/system/src/Tests/Ajax/FrameworkTest.php
Tests the behavior of an error alert command.
MenuTest::testMenuParentsJsAccess in core/modules/menu_ui/src/Tests/MenuTest.php
Tests if administrative users other than user 1 can access the menu parents AJAX callback.
RouterTest::testControllerResolutionAjax in core/modules/system/src/Tests/Routing/RouterTest.php
Checks that an ajax request gets rendered as an Ajax response, by mime.

... See full list

File

core/modules/simpletest/src/WebTestBase.php, line 1598
Contains \Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function drupalGetAjax($path, array $options = array(), array $headers = array()) {
  if (!isset($options['query'][MainContentViewSubscriber::WRAPPER_FORMAT])) {
    $options['query'][MainContentViewSubscriber::WRAPPER_FORMAT] = 'drupal_ajax';
  }
  return Json::decode($this
    ->drupalGetXHR($path, $options, $headers));
}