function CronRunTest::testManualCron

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

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