CodeExplorer ActiveRulesDataCollectorSubscriber example
$ruleRepository ->
method('search'
) ->
willReturn(new EntitySearchResult( 'rule',
1,
new RuleCollection([$activeRule]),
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());