You are here

public function CronRunTest::testManualCron in Drupal 8

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. 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 138

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(t('Run cron'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertText(t('Cron ran successfully.'));
}