Issue #3380433 by Spokje, quietone: [random test failure] CronRunTest::testAutomatedCron

merge-requests/4377/merge
Dave Long 2023-08-17 14:27:44 +01:00
parent 67360f2abd
commit eaca861b38
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
1 changed files with 8 additions and 1 deletions

View File

@ -4,6 +4,7 @@ namespace Drupal\Tests\system\Functional\System;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\Traits\Core\CronRunTrait;
use Drupal\Tests\WaitTerminateTestTrait;
/**
* Tests cron runs.
@ -13,6 +14,7 @@ use Drupal\Tests\Traits\Core\CronRunTrait;
class CronRunTest extends BrowserTestBase {
use CronRunTrait;
use WaitTerminateTestTrait;
/**
* Modules to enable.
@ -56,7 +58,12 @@ class CronRunTest extends BrowserTestBase {
* need the exact time when cron is triggered.
*/
public function testAutomatedCron() {
// Test with a logged in user; anonymous users likely don't cause Drupal to
// To prevent race conditions between the admin_user login triggering cron
// and updating its state, and this test doing the same thing, we use
// \Drupal\Tests\WaitTerminateTestTrait::setWaitForTerminate.
$this->setWaitForTerminate();
// 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(['administer site configuration']);