You are here

function CronRunTestCase::testCronExceptions in Drupal 7

Make sure exceptions thrown on hook_cron() don't affect other modules.

File

modules/system/system.test, line 918
Tests for system.module.

Class

CronRunTestCase

Code

function testCronExceptions() {
  variable_del('common_test_cron');

  // The common_test module throws an exception. If it isn't caught, the tests
  // won't finish successfully.
  // The common_test_cron_helper module sets the 'common_test_cron' variable.
  $this
    ->cronRun();
  $result = variable_get('common_test_cron');
  $this
    ->assertEqual($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.');
}