You are here

public function StateItemTest::testInvalidTransitionApply in State Machine 8

@covers ::applyTransitionById @expectedException \InvalidArgumentException

File

tests/src/Kernel/StateItemTest.php, line 40

Class

StateItemTest
@coversDefaultClass \Drupal\state_machine\Plugin\Field\FieldType\StateItem @group state_machine

Namespace

Drupal\Tests\state_machine\Kernel

Code

public function testInvalidTransitionApply() {
  $entity = EntityTestWithBundle::create([
    'type' => 'first',
  ]);

  /** @var \Drupal\state_machine\Plugin\Field\FieldType\StateItemInterface $state_item */
  $state_item = $entity
    ->get('field_state')
    ->first();
  $state_item
    ->applyTransitionById('INVALID');
}