You are here

public function StateTransitionValidationTest::testIsTransitionAllowedWithValidTransition 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::testIsTransitionAllowedWithValidTransition()

@covers ::isTransitionAllowed @covers ::calculatePossibleTransitions

File

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

Class

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

Namespace

Drupal\Tests\workbench_moderation\Unit

Code

public function testIsTransitionAllowedWithValidTransition() {
  $state_transition_validation = new StateTransitionValidation($this
    ->setupEntityTypeManager(), $this
    ->setupQueryFactory());
  $this
    ->assertTrue($state_transition_validation
    ->isTransitionAllowed('draft', 'draft'));
  $this
    ->assertTrue($state_transition_validation
    ->isTransitionAllowed('draft', 'needs_review'));
  $this
    ->assertTrue($state_transition_validation
    ->isTransitionAllowed('needs_review', 'needs_review'));
  $this
    ->assertTrue($state_transition_validation
    ->isTransitionAllowed('needs_review', 'staging'));
  $this
    ->assertTrue($state_transition_validation
    ->isTransitionAllowed('staging', 'published'));
  $this
    ->assertTrue($state_transition_validation
    ->isTransitionAllowed('needs_review', 'draft'));
}