| 1 system.test | CronRunTestCase::testCronRun() | 
Test cron runs.
File
- core/modules/ system/ tests/ system.test, line 736 
- Tests for system.module.
Class
Code
function testCronRun() {
  global $base_url;
  // Run cron anonymously without any cron key.
  $this->backdropGet($base_url . '/core/cron.php', array('external' => TRUE));
  $this->assertResponse(403);
  // Run cron anonymously with a random cron key.
  $key = $this->randomName(16);
  $this->backdropGet($base_url . '/core/cron.php', array('external' => TRUE, 'query' => array('cron_key' => $key)));
  $this->assertResponse(403);
  // Run cron anonymously with the valid cron key.
  $key = state_get('cron_key');
  $this->backdropGet($base_url . '/core/cron.php', array('external' => TRUE, 'query' => array('cron_key' => $key)));
  $this->assertResponse(200);
}
