Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setPersonaRules example
public
function
testPreconditionRulePersonaRules
(
)
: void
{
$fakePersonaRule
=
new
AndRule
(
)
;
$personaRuleEntity
=
new
RuleEntity
(
)
;
$personaRuleEntity
->
setId
(
'R1'
)
;
$personaRuleEntity
->
setPayload
(
$fakePersonaRule
)
;
$promotion
=
new
PromotionEntity
(
)
;
$promotion
->
setCustomerRestriction
(
false
)
;
$promotion
->
setPersonaRules
(
new
RuleCollection
(
[
$personaRuleEntity
]
)
)
;
$expected
=
new
AndRule
(
[
new
OrRule
(
[
$fakePersonaRule
]
)
,
]
)
;
static
::
assertEquals
(
$expected
,
$promotion
->
getPreconditionRule
(
)
)
;
}