Commit ee12606d authored by webchick's avatar webchick

Issue #2467887 by joshi.rohit100: Rename drupalGetAJAX to drupalGetAjax for...

Issue #2467887 by joshi.rohit100: Rename drupalGetAJAX to drupalGetAjax for parity with drupalPostAjaxForm
parent ca3422f1
......@@ -864,13 +864,13 @@ public function testMenuParentsJsAccess() {
$admin = $this->drupalCreateUser(array('administer menu'));
$this->drupalLogin($admin);
// Just check access to the callback overall, the POST data is irrelevant.
$this->drupalGetAJAX('admin/structure/menu/parents');
$this->drupalGetAjax('admin/structure/menu/parents');
$this->assertResponse(200);
// Do standard user tests.
// Login the user.
$this->drupalLogin($this->authenticatedUser);
$this->drupalGetAJAX('admin/structure/menu/parents');
$this->drupalGetAjax('admin/structure/menu/parents');
$this->assertResponse(403);
}
......
......@@ -1542,7 +1542,7 @@ protected function drupalGetJSON($path, array $options = array(), array $headers
/**
* Requests a Drupal path in drupal_ajax format and JSON-decodes the response.
*/
protected function drupalGetAJAX($path, array $options = array(), array $headers = array()) {
protected function drupalGetAjax($path, array $options = array(), array $headers = array()) {
$headers[] = 'Accept: application/vnd.drupal-ajax';
return Json::decode($this->drupalGet($path, $options, $headers));
}
......
......@@ -93,7 +93,7 @@ public function testDialog() {
$this->assertRaw($dialog_contents, 'Non-JS modal dialog page present.');
// Emulate going to the JS version of the page and check the JSON response.
$ajax_result = $this->drupalGetAJAX('ajax-test/dialog-contents', array(), array('Accept: application/vnd.drupal-modal'));
$ajax_result = $this->drupalGetAjax('ajax-test/dialog-contents', array(), array('Accept: application/vnd.drupal-modal'));
$this->assertEqual($modal_expected_response, $ajax_result[3], 'Modal dialog JSON response matches.');
// Check that requesting a "normal" dialog without JS goes to a page.
......@@ -127,7 +127,7 @@ public function testDialog() {
// Emulate closing the dialog via an AJAX request. There is no non-JS
// version of this test.
$ajax_result = $this->drupalGetAJAX('ajax-test/dialog-close');
$ajax_result = $this->drupalGetAjax('ajax-test/dialog-close');
$this->assertEqual($close_expected_response, $ajax_result[0], 'Close dialog JSON response matches.');
// Test submitting via a POST request through the button for modals. This
......@@ -159,7 +159,7 @@ public function testDialog() {
$this->assertTrue(!empty($form), 'Non-JS form page present.');
// Emulate going to the JS version of the form and check the JSON response.
$ajax_result = $this->drupalGetAJAX('ajax-test/dialog-form', array(), array('Accept: application/vnd.drupal-modal'));
$ajax_result = $this->drupalGetAjax('ajax-test/dialog-form', array(), array('Accept: application/vnd.drupal-modal'));
$expected_ajax_settings = [
'edit-preview' => [
'callback' => '::preview',
......@@ -188,7 +188,7 @@ public function testDialog() {
$this->assertTrue(!empty($form), 'Non-JS entity form page present.');
// Emulate going to the JS version of the form and check the JSON response.
$ajax_result = $this->drupalGetAJAX('admin/structure/contact/add', array(), array('Accept: application/vnd.drupal-modal'));
$ajax_result = $this->drupalGetAjax('admin/structure/contact/add', array(), array('Accept: application/vnd.drupal-modal'));
$this->setRawContent($ajax_result[3]['data']);
// Remove the data, the form build id and token will never match.
unset($ajax_result[3]['data']);
......
......@@ -26,7 +26,7 @@ class FrameworkTest extends AjaxTestBase {
*/
public function testAJAXRender() {
// Verify that settings command is generated if JavaScript settings exist.
$commands = $this->drupalGetAJAX('ajax-test/render');
$commands = $this->drupalGetAjax('ajax-test/render');
$expected = new SettingsCommand(array('ajax' => 'test'), TRUE);
$this->assertCommand($commands, $expected->render(), '\Drupal\Core\Ajax\AjaxResponse::ajaxRender() loads JavaScript settings.');
}
......@@ -86,7 +86,7 @@ public function testAJAXRenderError() {
$edit = array(
'message' => 'Custom error message.',
);
$commands = $this->drupalGetAJAX('ajax-test/render-error', array('query' => $edit));
$commands = $this->drupalGetAjax('ajax-test/render-error', array('query' => $edit));
$expected = new AlertCommand($edit['message']);
$this->assertCommand($commands, $expected->render(), 'Custom error message is output.');
}
......
......@@ -219,7 +219,7 @@ public function testImmutableFormLegacyProtection() {
$build_id = (string) $build_id_fields[0]['value'];
// Try to poison the form cache.
$original = $this->drupalGetAJAX('form-test/form-storage-legacy/' . $build_id);
$original = $this->drupalGetAjax('form-test/form-storage-legacy/' . $build_id);
$this->assertEqual($original['form']['#build_id_old'], $build_id, 'Original build_id was recorded');
$this->assertNotEqual($original['form']['#build_id'], $build_id, 'New build_id was generated');
......@@ -229,7 +229,7 @@ public function testImmutableFormLegacyProtection() {
$this->assert($status, 'A watchdog message was logged by \Drupal::formBuilder()->setCache');
// Ensure that the form state was not poisoned by the preceding call.
$original = $this->drupalGetAJAX('form-test/form-storage-legacy/' . $build_id);
$original = $this->drupalGetAjax('form-test/form-storage-legacy/' . $build_id);
$this->assertEqual($original['form']['#build_id_old'], $build_id, 'Original build_id was recorded');
$this->assertNotEqual($original['form']['#build_id'], $build_id, 'New build_id was generated');
$this->assert(empty($original['form']['#poisoned']), 'Original form structure was preserved');
......
......@@ -212,7 +212,7 @@ public function testUserAccount() {
public function testControllerResolutionAjax() {
// This will fail with a JSON parse error if the request is not routed to
// The correct controller.
$this->drupalGetAJAX('/router_test/test10');
$this->drupalGetAjax('/router_test/test10');
$this->assertEqual($this->drupalGetHeader('Content-Type'), 'application/json', 'Correct mime content type was returned');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment