You are here

public function SchedulerContext::prepare in Lightning Workflow 8.2

Prepares a scheduled transition, without saving it.

@When I prepare a transition to :state on :date at :time

Parameters

string $state: The destination state of the transition.

string $date: The date of the transition in a format that can be parsed by strtotime().

string $time: The time of the transition in a format that can be parsed by strtotime().

1 call to SchedulerContext::prepare()
SchedulerContext::add in modules/lightning_scheduler/tests/contexts/SchedulerContext.behat.inc
Schedules a moderation state transition.

File

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

Class

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

Namespace

Acquia\LightningExtension\Context

Code

public function prepare($state, $date, $time) {
  $assert = $this
    ->assertSession();
  try {
    $assert
      ->elementExists('named', [
      'link',
      'add another',
    ])
      ->click();
  } catch (ElementNotFoundException $e) {
    $assert
      ->elementExists('named', [
      'link',
      'Schedule a status change',
    ])
      ->click();
  }
  $assert
    ->fieldExists('Scheduled moderation state')
    ->selectOption($state);
  $this
    ->setValue('Scheduled transition date', date('Y-m-d', strtotime($date)));
  $this
    ->setValue('Scheduled transition time', date('H:i:s', strtotime($time)));
}