1 form.test FormAlterTestCase::testExecutionOrder()

Tests execution order of hook_form_alter() and hook_form_FORM_ID_alter().

File

core/modules/simpletest/tests/form.test, line 670
Unit tests for the Backdrop Form API.

Class

FormAlterTestCase
Test form alter hooks.

Code

function testExecutionOrder() {
  $this->backdropGet('form-test/alter');
  // Ensure that the order is first by module, then for a given module, the
  // id-specific one after the generic one.
  $expected = array(
    'form_test_form_alter() executed.',
    'form_test_form_form_test_alter_form_alter() executed.',
    'system_form_form_test_alter_form_alter() executed.',
  );
  $content = preg_replace('/\s+/', ' ', filter_xss($this->content, array()));
  $this->assert(strpos($content, implode(' ', $expected)) !== FALSE, format_string('Form alter hooks executed in the expected order.'));
}