You are here

protected function StateTransitionValidationTest::setupTransitionEntityList in Workbench Moderation 8.2

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

Builds an array of mocked Transition objects.

Return value

ModerationStateTransitionInterface[]

1 call to StateTransitionValidationTest::setupTransitionEntityList()
StateTransitionValidationTest::setupTransitionStorage in tests/src/Unit/StateTransitionValidationTest.php
Builds a mock storage object for Transitions.

File

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

Class

StateTransitionValidationTest
@coversDefaultClass \Drupal\workbench_moderation\StateTransitionValidation @group workbench_moderation

Namespace

Drupal\Tests\workbench_moderation\Unit

Code

protected function setupTransitionEntityList() {
  $transition = $this
    ->prophesize(ModerationStateTransitionInterface::class);
  $transition
    ->id()
    ->willReturn('draft__needs_review');
  $transition
    ->getFromState()
    ->willReturn('draft');
  $transition
    ->getToState()
    ->willReturn('needs_review');
  $list[$transition
    ->reveal()
    ->id()] = $transition
    ->reveal();
  $transition = $this
    ->prophesize(ModerationStateTransitionInterface::class);
  $transition
    ->id()
    ->willReturn('needs_review__staging');
  $transition
    ->getFromState()
    ->willReturn('needs_review');
  $transition
    ->getToState()
    ->willReturn('staging');
  $list[$transition
    ->reveal()
    ->id()] = $transition
    ->reveal();
  $transition = $this
    ->prophesize(ModerationStateTransitionInterface::class);
  $transition
    ->id()
    ->willReturn('staging__published');
  $transition
    ->getFromState()
    ->willReturn('staging');
  $transition
    ->getToState()
    ->willReturn('published');
  $list[$transition
    ->reveal()
    ->id()] = $transition
    ->reveal();
  $transition = $this
    ->prophesize(ModerationStateTransitionInterface::class);
  $transition
    ->id()
    ->willReturn('needs_review__draft');
  $transition
    ->getFromState()
    ->willReturn('needs_review');
  $transition
    ->getToState()
    ->willReturn('draft');
  $list[$transition
    ->reveal()
    ->id()] = $transition
    ->reveal();
  $transition = $this
    ->prophesize(ModerationStateTransitionInterface::class);
  $transition
    ->id()
    ->willReturn('draft__draft');
  $transition
    ->getFromState()
    ->willReturn('draft');
  $transition
    ->getToState()
    ->willReturn('draft');
  $list[$transition
    ->reveal()
    ->id()] = $transition
    ->reveal();
  $transition = $this
    ->prophesize(ModerationStateTransitionInterface::class);
  $transition
    ->id()
    ->willReturn('needs_review__needs_review');
  $transition
    ->getFromState()
    ->willReturn('needs_review');
  $transition
    ->getToState()
    ->willReturn('needs_review');
  $list[$transition
    ->reveal()
    ->id()] = $transition
    ->reveal();
  $transition = $this
    ->prophesize(ModerationStateTransitionInterface::class);
  $transition
    ->id()
    ->willReturn('published__published');
  $transition
    ->getFromState()
    ->willReturn('published');
  $transition
    ->getToState()
    ->willReturn('published');
  $list[$transition
    ->reveal()
    ->id()] = $transition
    ->reveal();
  return $list;
}