diff options
Diffstat (limited to 'modules/trigger/trigger.test')
-rw-r--r-- | modules/trigger/trigger.test | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/trigger/trigger.test b/modules/trigger/trigger.test index a662e33e7..72a496909 100644 --- a/modules/trigger/trigger.test +++ b/modules/trigger/trigger.test @@ -109,3 +109,43 @@ class TriggerContentTestCase extends DrupalWebTestCase { return $info[$action]; } } + +/** + * Test cron trigger. + */ +class TriggerCronTestCase extends DrupalWebTestCase { + function getInfo() { + return array( + 'name' => t('Trigger cron (system) actions'), + 'description' => t('Perform various tests with cron trigger.') , + 'group' => t('Trigger'), + ); + } + + function setUp() { + parent::setUp('trigger', 'trigger_test'); + } + + /** + * Assign an action to a trigger, then pull the trigger, and make sure the actions fire. + */ + function testActionsCron() { + $action = 'trigger_test_system_cron_action'; + $hash = md5($action); + + // Create administrative user. + $test_user = $this->drupalCreateUser(array('administer actions')); + $this->drupalLogin($test_user); + + // Select our test action and assign it to a cron run trigger. + $edit = array('aid' => $hash); + $this->drupalPost('admin/build/trigger/cron', $edit, t('Assign')); + + // Force a cron run. + drupal_cron_run(); + + // Make sure the actions fire. + $action_run = variable_get('trigger_test_system_cron_action', FALSE); + $this->assertTrue($action_run, t('Check that the cron run triggered the test action.')); + } +} |