Index: modules/trigger/trigger.module =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.module,v retrieving revision 1.32 diff -u -p -r1.32 trigger.module --- modules/trigger/trigger.module 26 Apr 2009 09:14:32 -0000 1.32 +++ modules/trigger/trigger.module 26 Apr 2009 18:24:18 -0000 @@ -371,10 +371,10 @@ function _trigger_comment($a1, $op) { * Implementation of hook_cron(). */ function trigger_cron() { - $aids = _trigger_get_hook_aids('cron'); + $aids = _trigger_get_hook_aids('cron', 'run'); $context = array( 'hook' => 'cron', - 'op' => '', + 'op' => 'run', ); // Cron does not act on any specific object. $object = NULL; Index: modules/trigger/trigger.test =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.test,v retrieving revision 1.7 diff -u -p -r1.7 trigger.test --- modules/trigger/trigger.test 31 Mar 2009 01:49:54 -0000 1.7 +++ modules/trigger/trigger.test 26 Apr 2009 18:24:18 -0000 @@ -109,3 +109,39 @@ class TriggerContentTestCase extends Dru return $info[$action]; } } + +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'); + } + + /** + * Test cron trigger. + */ + function testActionsCron() { + $action = 'trigger_test_system_cron_action'; + $hash = md5($action); + + // Assign an action to a trigger, then pull the trigger, and make sure the actions fire. + $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(); + + $action_run = variable_get('trigger_test_system_cron_action', FALSE); + $this->assertTrue($action_run, t('Check that the cron run triggered the test action.')); + } +}