You are here

public function CronRunTest::testManualCron in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/System/CronRunTest.php \Drupal\Tests\system\Functional\System\CronRunTest::testManualCron()
  2. 9 core/modules/system/tests/src/Functional/System/CronRunTest.php \Drupal\Tests\system\Functional\System\CronRunTest::testManualCron()

Ensure that the manual cron run is working.

File

core/modules/system/tests/src/Functional/System/CronRunTest.php, line 141

Class

CronRunTest
Tests cron runs.

Namespace

Drupal\Tests\system\Functional\System

Code

public function testManualCron() {
  $admin_user = $this
    ->drupalCreateUser([
    'administer site configuration',
  ]);
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet('admin/reports/status/run-cron');
  $this
    ->assertSession()
    ->statusCodeEquals(403);
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->clickLink('Run cron');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('Cron ran successfully.');
}