Commit 0e666ab0 authored by xjm's avatar xjm

Issue #2850670 by scott_euser, timmillwood: Add unit test coverage to ensure...

Issue #2850670 by scott_euser, timmillwood: Add unit test coverage to ensure already existing transitions aren't allowed
parent 178a615c
......@@ -610,6 +610,22 @@ public function testSetTransitionFromStatesMissingState() {
$workflow->setTransitionFromStates('create_new_draft', ['draft', 'published', 'archived']);
}
/**
* @covers ::setTransitionFromStates
*/
public function testSetTransitionFromStatesAlreadyExists() {
$this->setExpectedException(\InvalidArgumentException::class, "The 'create_new_draft' transition already allows 'draft' to 'draft' transitions in workflow 'test'");
$workflow = new Workflow(['id' => 'test', 'type' => 'test_type'], 'workflow');
$workflow
->addState('draft', 'Draft')
->addState('archived', 'Archived')
->addState('needs_review', 'Needs Review')
->addTransition('create_new_draft', 'Create new draft', ['draft'], 'draft')
->addTransition('needs_review', 'Needs review', ['needs_review'], 'draft');
$workflow->setTransitionFromStates('needs_review', ['draft']);
}
/**
* @covers ::deleteTransition
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment