diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-04-28 12:36:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-04-28 12:36:26 +0000 |
commit | 19a45ce5446f1ebc87f98d294a3acffdc8b54478 (patch) | |
tree | 29182a43073943cc35a35aa4d68964a44e7eaa08 /modules/simpletest/tests/form.test | |
parent | 748c31038d0de19185c7c176731d7eed958b7c9d (diff) | |
download | brdo-19a45ce5446f1ebc87f98d294a3acffdc8b54478.tar.gz brdo-19a45ce5446f1ebc87f98d294a3acffdc8b54478.tar.bz2 |
- Patch #765860 by effulgentsia, dww, dereine, mikey_p, sun: make drupal_alter() support multiple alter hooks executed by module weight.
Diffstat (limited to 'modules/simpletest/tests/form.test')
-rw-r--r-- | modules/simpletest/tests/form.test | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index 7ecfde9ac..40c7490da 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -210,6 +210,40 @@ class FormsTestCase extends DrupalWebTestCase { } /** + * Test form alter hooks. + */ +class FormAlterTestCase extends DrupalWebTestCase { + public static function getInfo() { + return array( + 'name' => 'Form alter hooks', + 'description' => 'Tests hook_form_alter() and hook_form_FORM_ID_alter().', + 'group' => 'Form API', + ); + } + + function setUp() { + parent::setUp('form_test'); + } + + /** + * Tests execution order of hook_form_alter() and hook_form_FORM_ID_alter(). + */ + function testExecutionOrder() { + $this->drupalGet('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( + 'block_form_form_test_alter_form_alter() executed.', + '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, t('Form alter hooks executed in the expected order.')); + } +} + +/** * Test form validation handlers. */ class FormValidationTestCase extends DrupalWebTestCase { |