- Patch #261836 by dropcube: tests for cron.
parent
01223c9f49
commit
bc5f69a333
|
@ -132,7 +132,7 @@ class IPAddressBlocking extends DrupalWebTestCase {
|
|||
function getInfo() {
|
||||
return array(
|
||||
'name' => t('IP address blocking'),
|
||||
'description' => t('Tests IP address blocking.'),
|
||||
'description' => t('Test IP address blocking.'),
|
||||
'group' => t('System')
|
||||
);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ class IPAddressBlocking extends DrupalWebTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests a variety of user input to confirm correct validation and saving of data.
|
||||
* Test a variety of user input to confirm correct validation and saving of data.
|
||||
*/
|
||||
function testIPAddressValidation() {
|
||||
$this->drupalGet('admin/settings/ip-blocking');
|
||||
|
@ -193,3 +193,38 @@ class IPAddressBlocking extends DrupalWebTestCase {
|
|||
$this->assertText(t('You may not block your own IP address.'));
|
||||
}
|
||||
}
|
||||
|
||||
class CronRun extends DrupalWebTestCase {
|
||||
/**
|
||||
* Implementation of getInfo().
|
||||
*/
|
||||
function getInfo() {
|
||||
return array(
|
||||
'name' => t('Cron run'),
|
||||
'description' => t('Test cron run.'),
|
||||
'group' => t('System')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test cron runs.
|
||||
*/
|
||||
function testCronRun() {
|
||||
// Run cron anonymously without any cron key.
|
||||
$this->drupalGet('cron.php');
|
||||
$this->assertResponse(403);
|
||||
|
||||
// Run cron anonymously with a random cron key.
|
||||
$key = $this->randomName(16);
|
||||
$this->drupalGet('cron.php', array('query' => 'cron_key=' . $key));
|
||||
$this->assertResponse(403);
|
||||
|
||||
// Run cron anonymously with the valid cron key.
|
||||
$key = variable_get('cron_key', 'drupal');
|
||||
$this->drupalGet('cron.php', array('query' => 'cron_key=' . $key));
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Execute cron directly.
|
||||
$this->assertTrue(drupal_cron_run(), t('Cron ran successfully.'));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue