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