You are here

public function StateTest::testGetTransitionToException in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workflows/tests/src/Unit/StateTest.php \Drupal\Tests\workflows\Unit\StateTest::testGetTransitionToException()

@covers ::getTransitionTo

File

core/modules/workflows/tests/src/Unit/StateTest.php, line 69

Class

StateTest
@coversDefaultClass \Drupal\workflows\State

Namespace

Drupal\Tests\workflows\Unit

Code

public function testGetTransitionToException() {
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage("Can not transition to 'published' state");
  $workflow_type = new TestType([], '', []);
  $workflow_type
    ->addState('draft', 'Draft');
  $state = $workflow_type
    ->getState('draft');
  $state
    ->getTransitionTo('published');
}