Skip to content
Snippets Groups Projects

Issue #3380433: [random test failure] CronRunTest::testAutomatedCron

Closed spokje requested to merge issue/drupal-3380433:3380433-random-test-failure into 11.x
1 file
+ 8
1
Compare changes
  • Side-by-side
  • Inline
@@ -4,6 +4,7 @@
@@ -4,6 +4,7 @@
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\Traits\Core\CronRunTrait;
use Drupal\Tests\Traits\Core\CronRunTrait;
 
use Drupal\Tests\WaitTerminateTestTrait;
/**
/**
* Tests cron runs.
* Tests cron runs.
@@ -13,6 +14,7 @@
@@ -13,6 +14,7 @@
class CronRunTest extends BrowserTestBase {
class CronRunTest extends BrowserTestBase {
use CronRunTrait;
use CronRunTrait;
 
use WaitTerminateTestTrait;
/**
/**
* Modules to enable.
* Modules to enable.
@@ -56,7 +58,12 @@ public function testCronRun() {
@@ -56,7 +58,12 @@ public function testCronRun() {
* need the exact time when cron is triggered.
* need the exact time when cron is triggered.
*/
*/
public function testAutomatedCron() {
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
// fully bootstrap, because of the internal page cache or an external
// reverse proxy. Reuse this user for disabling cron later in the test.
// reverse proxy. Reuse this user for disabling cron later in the test.
$admin_user = $this->drupalCreateUser(['administer site configuration']);
$admin_user = $this->drupalCreateUser(['administer site configuration']);
Loading