public function WorkflowStatesTest::test in Lightning Workflow 8.2
Tests that workflow states look the way we expect them to.
File
- tests/
src/ ExistingSite/ WorkflowStatesTest.php, line 17
Class
- WorkflowStatesTest
- @group lightning @group lightning_workflow
Namespace
Drupal\Tests\lightning_workflow\ExistingSiteCode
public function test() {
/** @var \Drupal\workflows\WorkflowInterface $workflow */
$workflow = entity_load('workflow', 'editorial');
$this
->assertInstanceOf(WorkflowInterface::class, $workflow);
$plugin = $workflow
->getTypePlugin();
$this
->assertSame('Send to review', $plugin
->getTransition('review')
->label());
$this
->assertSame('Restore from archive', $plugin
->getTransition('archived_published')
->label());
$this
->assertFalse($plugin
->hasTransition('archived_draft'));
$this
->assertArrayHasKey('archived', $plugin
->getTransition('create_new_draft')
->from());
$this
->assertSame('create_new_draft', $plugin
->getTransitionFromStateToState('archived', 'draft')
->id());
}