function CronRunTest::testCronExceptions

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

File

drupal/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php, line 92
Definition of Drupal\system\Tests\System\CronRunTest.

Class

CronRunTest

Namespace

Drupal\system\Tests\System

Code

function testCronExceptions() {
  state()
    ->delete('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 = state()
    ->get('common_test.cron');
  $this
    ->assertEqual($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.');
}