CronRunTrait.php

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

Namespace

Drupal\Tests\Traits\Core

File

core/tests/Drupal/Tests/Traits/Core/CronRunTrait.php

View source
<?php

namespace Drupal\Tests\Traits\Core;


/**
 * Adds ability to run cron from tests.
 */
trait CronRunTrait {
    
    /**
     * Runs cron on the test site.
     */
    protected function cronRun() {
        $this->drupalGet('cron/' . \Drupal::state()->get('system.cron_key'));
    }

}

Traits

Title Deprecated Summary
CronRunTrait Adds ability to run cron from tests.

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