Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setBlocked example
$this
->
assertFalse
(
$workflow
->
can
(
$subject
, 't5'
)
)
;
$this
->
assertTrue
(
$workflow
->
can
(
$subject
, 't6'
)
)
;
}
public
function
testCanWithGuard
(
)
{
$definition
=
$this
->
createComplexWorkflowDefinition
(
)
;
$subject
=
new
Subject
(
)
;
$eventDispatcher
=
new
EventDispatcher
(
)
;
$eventDispatcher
->
addListener
(
'workflow.workflow_name.guard.t1',
function
DGuardEvent
$event
)
{
$event
->
setBlocked
(
true
)
;
}
)
;
$workflow
=
new
Workflow
(
$definition
,
new
MethodMarkingStore
(
)
,
$eventDispatcher
, 'workflow_name'
)
;
$this
->
assertFalse
(
$workflow
->
can
(
$subject
, 't1'
)
)
;
}
public
function
testCanDoesNotTriggerGuardEventsForNotEnabledTransitions
(
)
{
$definition
=
$this
->
createComplexWorkflowDefinition
(
)
;
$subject
=
new
Subject
(
)
;