Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getMatchingRuleCount example
null,
new
Criteria
(
)
,
Context::
createDefaultContext
(
)
)
)
;
$subscriber
=
new
ActiveRulesDataCollectorSubscriber
(
$ruleRepository
)
;
$subscriber
->
onContextResolved
(
$event
)
;
$subscriber
->
collect
(
new
Request
(
)
,
new
Response
(
)
)
;
$data
=
$subscriber
->
getData
(
)
;
static
::
assertEquals
(
1,
$subscriber
->
getMatchingRuleCount
(
)
)
;
static
::
assertArrayHasKey
(
$ruleId
,
$data
)
;
$rule
=
$data
[
$ruleId
]
;
static
::
assertInstanceOf
(
RuleEntity::
class
,
$rule
)
;
static
::
assertEquals
(
100,
$rule
->
getPriority
(
)
)
;
static
::
assertEquals
(
'Demo rule',
$rule
->
getName
(
)
)
;
$subscriber
->
reset
(
)
;
static
::
assertEquals
(
0,
$subscriber
->
getMatchingRuleCount
(
)
)
;
}