Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createOrderWithPartiallyReturnedDeliveryState example
$stateMachine
=
$this
->stateMachineRegistry->
getStateMachine
(
$this
->stateMachineName,
$context
)
;
static
::
assertNotNull
(
$stateMachine
->
getStates
(
)
)
;
static
::
assertEquals
(
3,
$stateMachine
->
getStates
(
)
->
count
(
)
)
;
static
::
assertNotNull
(
$stateMachine
->
getTransitions
(
)
)
;
static
::
assertEquals
(
4,
$stateMachine
->
getTransitions
(
)
->
count
(
)
)
;
}
public
function
testStateMachineAvailableTransitionShouldIncludeReOpenAndReTourTransition
(
)
: void
{
$this
->
createOrderWithPartiallyReturnedDeliveryState
(
)
;
$availableTransitions
=
$this
->stateMachineRegistry->
getAvailableTransitions
(
'order_delivery',
$this
->
fetchFirstIdFromTable
(
'order_delivery'
)
, 'stateId', Context::
createDefaultContext
(
)
)
;
static
::
assertNotEmpty
(
$availableTransitions
)
;
static
::
assertCount
(
2,
$availableTransitions
)
;
$reopenActionExisted
= false;
$retourActionExisted
= false;
/** @var StateMachineTransitionEntity $transition */
foreach
(
$availableTransitions
as
$transition
)
{
if
(
$transition
->
getActionName
(
)
=== 'reopen'
)
{