diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-03-28 18:09:11 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-03-28 18:09:11 +0000 |
commit | 95023b8c1314374d8dda9d7b8dcead5a946b12b0 (patch) | |
tree | 43d5c1323df69de9bc4571a8fd90cf94f8e5b7f0 /modules/simpletest/tests/form.test | |
parent | 1c2033f0f88fd42fa30e86f4e03b27262fb49318 (diff) | |
download | brdo-95023b8c1314374d8dda9d7b8dcead5a946b12b0.tar.gz brdo-95023b8c1314374d8dda9d7b8dcead5a946b12b0.tar.bz2 |
#297972 by scor, yched, Steven Jones, and heyrocker: Allow drupal_execute() to be performed within batch API (with tests).
Diffstat (limited to 'modules/simpletest/tests/form.test')
-rw-r--r-- | modules/simpletest/tests/form.test | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index 9dfa7cf8c..be5c3117d 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -344,3 +344,42 @@ class FormsFormCleanIdFunctionalTest extends DrupalWebTestCase { } } + +/** + * Test using drupal_execute in a batch. + */ +class FormAPITestCase extends DrupalWebTestCase { + + function getInfo() { + return array( + 'name' => t('Drupal Execute and Batch API'), + 'description' => t('Tests the compatibility of drupal_execute and the Batch API'), + 'group' => t('Form API'), + ); + } + + /** + * Check that we can run drupal_execute during a batch. + */ + function testDrupalExecuteInBatch() { + + // Our test is going to modify the following variable. + variable_set('form_test_mock_submit', 'initial_state'); + + // This is a page that sets a batch, which calls drupal_execute, which + // modifies the variable we set up above. + $this->drupalGet('form_test/drupal_execute_batch_api'); + + // If the drupal_execute call executed correctly our test variable will be + // set to 'form_submitted'. + $this->assertEqual('form_submitted', variable_get('form_test_mock_submit', 'initial_state'), t('Check drupal_execute called submit handlers when running in a batch')); + + // Clean our variable up. + variable_del('form_test_mock_submit'); + } + + function setUp() { + parent::setUp('form_test'); + } + +} |