function CronRunTest::testManualCron

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/System/CronRunTest.php \Drupal\Tests\system\Functional\System\CronRunTest::testManualCron()
  2. 8.9.x core/modules/system/tests/src/Functional/System/CronRunTest.php \Drupal\Tests\system\Functional\System\CronRunTest::testManualCron()
  3. 10 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 150

Class

CronRunTest
Tests cron runs.

Namespace

Drupal\Tests\system\Functional\System

Code

public function testManualCron() : void {
    $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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.