You are here

public function SchedulerContext::runCron in Lightning Workflow 8.3

Runs cron by invoking the /cron URL.

@When I run cron after :offset second(s)

Parameters

int $offset: (optional) A number of seconds, relative to the time the scenario began. This number will be added to the time the scenario began and used as the time the cron request occurred.

File

modules/lightning_scheduler/tests/contexts/SchedulerContext.behat.inc, line 79

Class

SchedulerContext
Contains step definitions for interacting with the Lightning Scheduler UI.

Namespace

Acquia\LightningExtension\Context

Code

public function runCron($offset = 0) {
  $state = \Drupal::state();
  $state
    ->set('lightning_scheduler.request_time', $this->startTime + $offset);
  $url = Url::fromRoute('system.cron', [
    'key' => $state
      ->get('system.cron_key'),
  ]);
  $url = $this
    ->locatePath($url
    ->toString());
  \Drupal::httpClient()
    ->get($url);
}