diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-09-19 11:07:37 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-09-19 11:07:37 +0000 |
commit | fd1c63b5c0ce91849d6088b7aad40b27ea7bb96f (patch) | |
tree | 7742fc7fdc55f819c066be08a3419995b591439b /modules/simpletest/tests | |
parent | a557b0de2ac5d0b2048a456f94f9b8047afa71b9 (diff) | |
download | brdo-fd1c63b5c0ce91849d6088b7aad40b27ea7bb96f.tar.gz brdo-fd1c63b5c0ce91849d6088b7aad40b27ea7bb96f.tar.bz2 |
- Patch ##525540 by jvandyk, sun, jhodgdon, fago | webchick, TheRec, Dave Reid, brianV, sun.core, cweagans, Dries: gave trigger.module and includes/actions.inc an API overhaul. Simplified definitions of actions and triggers and removed dependency on the combination of hooks and operations. Triggers now directly map to module hooks.
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r-- | modules/simpletest/tests/actions.test | 18 | ||||
-rw-r--r-- | modules/simpletest/tests/actions_loop_test.module | 20 |
2 files changed, 16 insertions, 22 deletions
diff --git a/modules/simpletest/tests/actions.test b/modules/simpletest/tests/actions.test index a36684047..12a97cc5f 100644 --- a/modules/simpletest/tests/actions.test +++ b/modules/simpletest/tests/actions.test @@ -26,27 +26,27 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase { // Make a POST request to the individual action configuration page. $edit = array(); - $action_description = $this->randomName(); - $edit['actions_description'] = $action_description; + $action_label = $this->randomName(); + $edit['actions_label'] = $action_label; $edit['url'] = 'admin'; $this->drupalPost('admin/config/system/actions/configure/' . md5('system_goto_action'), $edit, t('Save')); // Make sure that the new complex action was saved properly. $this->assertText(t('The action has been successfully saved.'), t("Make sure we get a confirmation that we've successfully saved the complex action.")); - $this->assertText($action_description, t("Make sure the action description appears on the configuration page after we've saved the complex action.")); + $this->assertText($action_label, t("Make sure the action label appears on the configuration page after we've saved the complex action.")); // Make another POST request to the action edit page. $this->clickLink(t('configure')); $edit = array(); - $new_action_description = $this->randomName(); - $edit['actions_description'] = $new_action_description; + $new_action_label = $this->randomName(); + $edit['actions_label'] = $new_action_label; $edit['url'] = 'admin'; $this->drupalPost('admin/config/system/actions/configure/1', $edit, t('Save')); // Make sure that the action updated properly. $this->assertText(t('The action has been successfully saved.'), t("Make sure we get a confirmation that we've successfully updated the complex action.")); - $this->assertNoText($action_description, t("Make sure the old action description does NOT appear on the configuration page after we've updated the complex action.")); - $this->assertText($new_action_description, t("Make sure the action description appears on the configuration page after we've updated the complex action.")); + $this->assertNoText($action_label, t("Make sure the old action label does NOT appear on the configuration page after we've updated the complex action.")); + $this->assertText($new_action_label, t("Make sure the action label appears on the configuration page after we've updated the complex action.")); // Make sure that deletions work properly. $this->clickLink(t('delete')); @@ -54,9 +54,9 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase { $this->drupalPost('admin/config/system/actions/delete/1', $edit, t('Delete')); // Make sure that the action was actually deleted. - $this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_description)), t('Make sure that we get a delete confirmation message.')); + $this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), t('Make sure that we get a delete confirmation message.')); $this->drupalGet('admin/config/system/actions/manage'); - $this->assertNoText($new_action_description, t("Make sure the action description does not appear on the overview page after we've deleted the action.")); + $this->assertNoText($new_action_label, t("Make sure the action label does not appear on the overview page after we've deleted the action.")); $exists = db_query('SELECT aid FROM {actions} WHERE callback = :callback', array(':callback' => 'drupal_goto_action'))->fetchField(); $this->assertFalse($exists, t('Make sure the action is gone from the database after being deleted.')); } diff --git a/modules/simpletest/tests/actions_loop_test.module b/modules/simpletest/tests/actions_loop_test.module index 58b47fd8b..a31415891 100644 --- a/modules/simpletest/tests/actions_loop_test.module +++ b/modules/simpletest/tests/actions_loop_test.module @@ -2,15 +2,13 @@ // $Id$ /** - * Implement hook_hook_info(). + * Implement hook_trigger_info(). */ -function actions_loop_test_hook_info() { +function actions_loop_test_trigger_info() { return array( 'actions_loop_test' => array( 'watchdog' => array( - 'run' => array( - 'runs when' => t('When a message is logged'), - ), + 'label' => t('When a message is logged'), ), ), ); @@ -26,13 +24,11 @@ function actions_loop_test_watchdog(array $log_entry) { } // Get all the action ids assigned to the trigger on the watchdog hook's // "run" event. - $aids = _trigger_get_hook_aids('watchdog', 'run'); + $aids = trigger_get_assigned_actions('watchdog'); // We can pass in any applicable information in $context. There isn't much in - // this case, but we'll pass in the hook name and the operation name as the - // bare minimum. + // this case, but we'll pass in the hook name as the bare minimum. $context = array( 'hook' => 'watchdog', - 'op' => 'run', ); // Fire the actions on the associated object ($log_entry) and the context // variable. @@ -54,12 +50,10 @@ function actions_loop_test_init() { function actions_loop_test_action_info() { return array( 'actions_loop_test_log' => array( - 'description' => t('Write a message to the log.'), + 'label' => t('Write a message to the log.'), 'type' => 'system', 'configurable' => FALSE, - 'hooks' => array( - 'any' => TRUE, - ) + 'triggers' => array('any'), ), ); } |