Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createEventActionWithSalesChannelAndRule example
foreach
(
$eventActions
as
$eventAction
)
{
static
::
assertSame
(
0,
(int)
$eventAction
[
'active'
]
)
;
}
static
::
assertCount
(
5,
$eventActions
)
;
}
public
function
testMigrateEventActionToFlowWithSalesChannelAndRule
(
)
: void
{
$this
->
createEventActionWithSalesChannelAndRule
(
)
;
$migration
=
new
Migration1632215760MoveDataFromEventActionToFlow
(
)
;
$migration
->
update
(
$this
->connection
)
;
$criteria
=
new
Criteria
(
)
;
$criteria
->
addAssociation
(
'sequences'
)
;
/** @var FlowEntity $flow */
$flow
=
$this
->flowRepository->
search
(
$criteria
, Context::
createDefaultContext
(
)
)
->
first
(
)
;
$flowSequences
=
$flow
->
getSequences
(
)
;
foreach
(
$eventActions
as
$eventAction
)
{
static
::
assertSame
(
0,
(int)
$eventAction
[
'active'
]
)
;
}
static
::
assertCount
(
5,
$eventActions
)
;
}
public
function
testMigrateEventActionToFlowWithSalesChannelAndRule
(
)
: void
{
$this
->
createEventActionWithSalesChannelAndRule
(
)
;
$migration
=
new
Migration1639992771MoveDataFromEventActionToFlow
(
)
;
$migration
->
update
(
$this
->connection
)
;
$criteria
=
new
Criteria
(
)
;
$criteria
->
addAssociation
(
'sequences'
)
;
/** @var FlowEntity $flow */
$flow
=
$this
->flowRepository->
search
(
$criteria
, Context::
createDefaultContext
(
)
)
->
first
(
)
;
$flowSequences
=
$flow
->
getSequences
(
)
;
$flowsSequence
=
$this
->connection->
fetchAllAssociative
(
'SELECT * from `flow_sequence`'
)
;
static
::
assertCount
(
4,
$flowsSequence
)
;
$actionSequence
=
array_values
(
array_filter
(
$flowsSequence
,
fn
(
$sequence
)
=>
$sequence
[
'action_name'
]
!== null
)
)
;
static
::
assertCount
(
2,
$actionSequence
)
;
static
::
assertNotEquals
(
$actionSequence
[
0
]
[
'parent_id'
]
,
$actionSequence
[
1
]
[
'parent_id'
]
)
;
}
public
function
testMigrateEventActionToFlowWithSalesChannelAndRule
(
)
: void
{
$this
->
createEventActionWithSalesChannelAndRule
(
)
;
$migration
=
new
Migration1632215760MoveDataFromEventActionToFlow
(
)
;
$migration
->
update
(
$this
->connection
)
;
$newMigration
=
new
Migration1648803451FixInvalidMigrationOfBusinessEventToFlow
(
)
;
$newMigration
->
update
(
$this
->connection
)
;
$flowsSequence
=
$this
->connection->
fetchAllAssociative
(
'SELECT * from `flow_sequence`'
)
;
static
::
assertCount
(
3,
$flowsSequence
)
;
foreach
(
$eventActions
as
$eventAction
)
{
static
::
assertSame
(
0,
(int)
$eventAction
[
'active'
]
)
;
}
static
::
assertCount
(
5,
$eventActions
)
;
}
public
function
testMigrateEventActionToFlowWithSalesChannelAndRule
(
)
: void
{
$this
->
createEventActionWithSalesChannelAndRule
(
)
;
$migration
=
new
Migration1625583619MoveDataFromEventActionToFlow
(
)
;
$migration
->internal = true;
$migration
->
update
(
$this
->connection
)
;
$criteria
=
new
Criteria
(
)
;
$criteria
->
addAssociation
(
'sequences'
)
;
/** @var FlowEntity $flow */
$flow
=
$this
->flowRepository->
search
(
$criteria
, Context::
createDefaultContext
(
)
)
->
first
(
)
;
$flowSequences
=
$flow
->
getSequences
(
)
;