You are here

protected function Validator::getTransitionFromStates in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/StateTransitionValidationTest.php \Drupal\Tests\workbench_moderation\Unit\Validator::getTransitionFromStates()

Returns the transition object that transitions from one state to another.

Parameters

string $from: The name of the "from" state.

string $to: The name of the "to" state.

Return value

\Drupal\workbench_moderation\Entity\ModerationStateTransition|null A transition object, or NULL if there is no such transition in the system.

Overrides StateTransitionValidation::getTransitionFromStates

File

tests/src/Unit/StateTransitionValidationTest.php, line 245

Class

Validator
Testable subclass for selected tests.

Namespace

Drupal\Tests\workbench_moderation\Unit

Code

protected function getTransitionFromStates($from, $to) {
  if ($from == 'draft' && $to == 'draft') {
    return $this
      ->transitionStorage()
      ->loadMultiple([
      'draft__draft',
    ])[0];
  }
}