public function testAvoidInfiniteLoopEventsWithLotsOfPromotions(): void
{ $productId = Uuid::
randomHex();
$this->
createTestFixtureProduct($productId, 119, 19,
$this->
getContainer(),
$this->
getContext());
$codes =
[100, 1, 42, 13, 19
];
$this->
createBulkPromotions($codes);
$dispatcher =
$this->
getContainer()->
get('event_dispatcher'
);
$addListener =
$this->
getMockBuilder(CallableClass::
class)->
getMock();
$addListener->
expects(static::
exactly(1 + \
count($codes)))->
method('__invoke'
);
$this->
addEventListener($dispatcher, BeforeLineItemAddedEvent::
class,
$addListener);
$cart =
$this->cartService->
getCart($this->
getContext()->
getToken(),
$this->
getContext());
// add all our prepared test fixtures
// and promotions to our current cart.