Commit 0880f31c authored by alexpott's avatar alexpott
Browse files

Issue #2458289 by Wim Leers: CronRunTest::testAutomaticCron() should test with...

Issue #2458289 by Wim Leers: CronRunTest::testAutomaticCron() should test with an authenticated user
parent 2eee2594
......@@ -49,6 +49,12 @@ function testCronRun() {
* need the exact time when cron is triggered.
*/
function testAutomaticCron() {
// Test with a logged in user; anonymous users likely don't cause Drupal to
// fully bootstrap, because of the internal page cache or an external
// reverse proxy. Reuse this user for disabling cron later in the test.
$admin_user = $this->drupalCreateUser(array('administer site configuration'));
$this->drupalLogin($admin_user);
// Ensure cron does not run when the cron threshold is enabled and was
// not passed.
$cron_last = time();
......@@ -68,8 +74,6 @@ function testAutomaticCron() {
$this->assertTrue($cron_last < \Drupal::state()->get('system.cron_last'), 'Cron runs when the cron threshold is passed.');
// Disable the cron threshold through the interface.
$admin_user = $this->drupalCreateUser(array('administer site configuration'));
$this->drupalLogin($admin_user);
$this->drupalPostForm('admin/config/system/cron', array('cron_safe_threshold' => 0), t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'));
$this->drupalLogout();
......
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