public function testRegisterEventWithCustomerRules(): void
{ $ids =
new IdsCollection();
$rule =
[ 'id' =>
$ids->
create('rule'
),
'name' => 'Test rule',
'priority' => 1,
'conditions' =>
[ ['type'
=> (new CustomerLoggedInRule())->
getName(), 'value' =>
['isLoggedIn' => true
]],
],
];
$this->
getContainer()->
get('rule.repository'
)->
create([$rule], Context::
createDefaultContext());
$ruleIds = null;
$this->
getContainer()->
get('event_dispatcher'
)->
addListener(CustomerRegisterEvent::
class,
static function DCustomerRegisterEvent
$event) use (&
$ruleIds): void
{ $ruleIds =
$event->
getSalesChannelContext()->
getRuleIds();
});
$this->browser->
request('POST', '/store-api/account/register',
[],
[],
['CONTENT_TYPE' => 'application/json'
],
json_encode($this->
getRegistrationData(), \JSON_THROW_ON_ERROR
));