function FrameworkTest::testAJAXRenderError

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php \Drupal\Tests\system\Functional\Ajax\FrameworkTest::testAJAXRenderError()
  2. 10 core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php \Drupal\Tests\system\Functional\Ajax\FrameworkTest::testAJAXRenderError()
  3. 11.x core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php \Drupal\Tests\system\Functional\Ajax\FrameworkTest::testAJAXRenderError()

Tests the behavior of an error alert command.

File

core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php, line 82

Class

FrameworkTest
Performs tests on AJAX framework functions.

Namespace

Drupal\Tests\system\Functional\Ajax

Code

public function testAJAXRenderError() {
    // Verify custom error message.
    $edit = [
        'message' => 'Custom error message.',
    ];
    $commands = $this->drupalGetAjax('ajax-test/render-error', [
        'query' => $edit,
    ]);
    $expected = new AlertCommand($edit['message']);
    $this->assertCommand($commands, $expected->render(), 'Custom error message is output.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.