try { $workflow->
apply($subject, 't2',
$context);
$this->
fail('Should throw an exception'
);
} catch (NotEnabledTransitionException
$e) { $this->
assertSame('Transition "t2" is not enabled for workflow "unnamed".',
$e->
getMessage());
$this->
assertCount(1,
$e->
getTransitionBlockerList());
$list =
iterator_to_array($e->
getTransitionBlockerList());
$this->
assertSame('The marking does not enable the transition.',
$list[0
]->
getMessage());
$this->
assertSame($e->
getWorkflow(),
$workflow);
$this->
assertSame($e->
getSubject(),
$subject);
$this->
assertSame($e->
getTransitionName(), 't2'
);
$this->
assertSame($e->
getContext(),
$context);
} } public function testApply() { $definition =
$this->
createComplexWorkflowDefinition();
$subject =
new Subject();
$workflow =
new Workflow($definition,
new MethodMarkingStore());