Verified Commit eaca861b authored by Dave Long's avatar Dave Long
Browse files

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

parent 67360f2a
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@

use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\Traits\Core\CronRunTrait;
use Drupal\Tests\WaitTerminateTestTrait;

/**
 * Tests cron runs.
@@ -13,6 +14,7 @@
class CronRunTest extends BrowserTestBase {

  use CronRunTrait;
  use WaitTerminateTestTrait;

  /**
   * Modules to enable.
@@ -56,7 +58,12 @@ public function testCronRun() {
   * 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']);