function AJAXFrameworkTestCase::testAJAXRenderError in SimpleTest 7
Test behavior of ajax_render_error().
File
- tests/
ajax.test, line 40
Class
- AJAXFrameworkTestCase
- Tests primary AJAX framework functions.
Code
function testAJAXRenderError() {
$result = $this
->drupalGetAJAX('ajax-test/render-error');
// Verify default error message.
$this
->assertEqual($result[0]['command'], 'alert', t('ajax_render_error() invokes alert command.'));
$this
->assertEqual($result[0]['text'], t('An error occurred while handling the request: The server received invalid input.'), t('Default error message is output.'));
// Verify custom error message.
$edit = array(
'message' => 'Custom error message.',
);
$result = $this
->drupalGetAJAX('ajax-test/render-error', $edit);
$this
->assertEqual($result[0]['text'], $edit['message'], t('Custom error message is output.'));
}