$this->
assertSame('19beefc8-6b1e-4716-9d07-a39bd6d16e34',
$blockers[0
]->
getCode());
} public function testBuildTransitionBlockerListReturnsReasonsProvidedInGuards() { $definition =
$this->
createSimpleWorkflowDefinition();
$subject =
new Subject();
$dispatcher =
new EventDispatcher();
$workflow =
new Workflow($definition,
new MethodMarkingStore(),
$dispatcher);
$dispatcher->
addListener('workflow.guard',
function DGuardEvent
$event) { $event->
addTransitionBlocker(new TransitionBlocker('Transition blocker 1', 'blocker_1'
));
$event->
addTransitionBlocker(new TransitionBlocker('Transition blocker 2', 'blocker_2'
));
});
$dispatcher->
addListener('workflow.guard',
function DGuardEvent
$event) { $event->
addTransitionBlocker(new TransitionBlocker('Transition blocker 3', 'blocker_3'
));
});
$dispatcher->
addListener('workflow.guard',
function DGuardEvent
$event) { $event->
setBlocked(true
);
});
$dispatcher->
addListener('workflow.guard',
function DGuardEvent
$event) { $event->
setBlocked(true, 'You should not pass !!'
);
});