trait CronRunTrait

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Traits/Core/CronRunTrait.php \Drupal\Tests\Traits\Core\CronRunTrait
  2. 8.9.x core/tests/Drupal/Tests/Traits/Core/CronRunTrait.php \Drupal\Tests\Traits\Core\CronRunTrait
  3. 11.x core/tests/Drupal/Tests/Traits/Core/CronRunTrait.php \Drupal\Tests\Traits\Core\CronRunTrait

Adds ability to run cron from tests.

Hierarchy

16 files declare their use of CronRunTrait
BrowserTestBaseTest.php in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
CronRunTest.php in core/modules/system/tests/src/Functional/System/CronRunTest.php
HelpTopicSearchTest.php in core/modules/help/tests/src/Functional/HelpTopicSearchTest.php
LocaleUpdateCronTest.php in core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php
ReEnableModuleFieldTest.php in core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php

... See full list

File

core/tests/Drupal/Tests/Traits/Core/CronRunTrait.php, line 10

Namespace

Drupal\Tests\Traits\Core
View source
trait CronRunTrait {
    
    /**
     * Runs cron on the test site.
     */
    protected function cronRun() {
        $this->drupalGet('cron/' . \Drupal::state()->get('system.cron_key'));
    }

}

Members

Title Sort descending Modifiers Object type Summary
CronRunTrait::cronRun protected function Runs cron on the test site.

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