Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
WorkflowExtension example
$metadataStore
=
new
InMemoryMetadataStore
(
[
'title' => 'workflow title'
]
,
[
'orderer' =>
[
'title' => 'ordered title'
]
]
,
$transitionsMetadata
)
;
$definition
=
new
Definition
(
$places
,
$transitions
, null,
$metadataStore
)
;
$workflow
=
new
Workflow
(
$definition
,
new
MethodMarkingStore
(
)
)
;
$registry
=
new
Registry
(
)
;
$supportStrategy
=
new
InstanceOfSupportStrategy
(
Subject::
class
)
;
$registry
->
addWorkflow
(
$workflow
,
$supportStrategy
)
;
$this
->extension =
new
WorkflowExtension
(
$registry
)
;
}
public
function
testCanTransition
(
)
{
$subject
=
new
Subject
(
)
;
$this
->
assertTrue
(
$this
->extension->
canTransition
(
$subject
, 't1'
)
)
;
$this
->
assertFalse
(
$this
->extension->
canTransition
(
$subject
, 't2'
)
)
;
}
public
function
testGetEnabledTransitions
(
)
{