$this->
clickLink('Add workflow'
);
$this->
submitForm(['label' => 'Test', 'id' => 'test', 'workflow_type' => 'workflow_type_test'
], 'Save'
);
$this->
assertSession()->
pageTextContains('Created the Test Workflow.'
);
$this->
assertSession()->
addressEquals('admin/config/workflow/workflows/manage/test/add_state'
);
$this->
drupalGet('/admin/config/workflow/workflows/manage/test'
);
$this->
assertSession()->
pageTextContains('This workflow has no states and will be disabled until there is at least one, add a new state.'
);
$this->
assertSession()->
pageTextContains('There are no states yet.'
);
$this->
clickLink('Add a new state'
);
$this->
submitForm(['label' => 'Published', 'id' => 'published'
], 'Save'
);
$this->
assertSession()->
pageTextContains('Created Published state.'
);
$workflow =
$workflow_storage->
loadUnchanged('test'
);
$this->
assertFalse($workflow->
getTypePlugin()->
getState('published'
)->
canTransitionTo('published'
), 'No default transition from published to published exists.'
);
$this->
clickLink('Add a new state'
);
// Don't create a draft to draft transition by default.
$this->
submitForm(['label' => 'Draft', 'id' => 'draft'
], 'Save'
);
$this->
assertSession()->
pageTextContains('Created Draft state.'
);
$workflow =
$workflow_storage->
loadUnchanged('test'
);
$this->
assertFalse($workflow->
getTypePlugin()->
getState('draft'
)->
canTransitionTo('draft'
), 'Can not transition from draft to draft'
);
$this->
clickLink('Add a new transition'
);
$this->
submitForm(['id' => 'publish', 'label' => 'Publish', 'from[draft]' => 'draft', 'to' => 'published'
], 'Save'
);
$this->
assertSession()->
pageTextContains('Created Publish transition.'
);