Commit 7abcf73b authored by Dries's avatar Dries

Issue #1847004 by swentel: Cron time still reads from variable_get() instead of state().

parent 55bdbb31
......@@ -98,4 +98,17 @@ function testCronExceptions() {
$result = state()->get('common_test.cron');
$this->assertEqual($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.');
}
/**
* Make sure the cron UI reads from the state storage.
*/
function testCronUI() {
$admin_user = $this->drupalCreateUser(array('administer site configuration'));
$this->drupalLogin($admin_user);
$this->drupalGet('admin/config/system/cron');
// Don't use REQUEST to calculate the exact time, because that will
// fail randomly. Look for the word 'years', because without a timestamp,
// the time will start at 1 January 1970.
$this->assertNoText('years');
}
}
......@@ -1508,7 +1508,7 @@ function system_cron_settings($form, &$form_state) {
'#submit' => array('system_run_cron_submit'),
);
$status = '<p>' . t('Last run: %cron-last ago.', array('%cron-last' => format_interval(REQUEST_TIME - variable_get('cron_last')),)) . '</p>';
$status = '<p>' . t('Last run: %cron-last ago.', array('%cron-last' => format_interval(REQUEST_TIME - state()->get('system.cron_last')))) . '</p>';
$form['status'] = array(
'#markup' => $status,
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment