Skip to content

Commit 942ca5a

Browse files
that-guy-iainnicolas-grekas
authored andcommitted
[Workflow] Clearer NotEnabledTransitionException message
1 parent 1a16ebc commit 942ca5a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Symfony/Component/Workflow/Exception/NotEnabledTransitionException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Workflow\WorkflowInterface;
1616

1717
/**
18-
* Thrown by Workflow when a not enabled transition is applied on a subject.
18+
* Thrown when a transition cannot be applied on a subject.
1919
*
2020
* @author Grégoire Pineau <lyrixx@lyrixx.info>
2121
*/
@@ -28,7 +28,7 @@ public function __construct(
2828
private TransitionBlockerList $transitionBlockerList,
2929
array $context = [],
3030
) {
31-
parent::__construct($subject, $transitionName, $workflow, \sprintf('Transition "%s" is not enabled for workflow "%s".', $transitionName, $workflow->getName()), $context);
31+
parent::__construct($subject, $transitionName, $workflow, \sprintf('Cannot apply transition "%s" on workflow "%s".', $transitionName, $workflow->getName()), $context);
3232
}
3333

3434
public function getTransitionBlockerList(): TransitionBlockerList

src/Symfony/Component/Workflow/Tests/WorkflowTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public function testApplyWithNotEnabledTransition()
286286

287287
$this->fail('Should throw an exception');
288288
} catch (NotEnabledTransitionException $e) {
289-
$this->assertSame('Transition "t2" is not enabled for workflow "unnamed".', $e->getMessage());
289+
$this->assertSame('Cannot apply transition "t2" on workflow "unnamed".', $e->getMessage());
290290
$this->assertCount(1, $e->getTransitionBlockerList());
291291
$list = iterator_to_array($e->getTransitionBlockerList());
292292
$this->assertSame('The marking does not enable the transition.', $list[0]->getMessage());

0 commit comments

Comments
 (0)