$eventDispatcher =
$this->
createMock(EventDispatcherInterface::
class);
$eventDispatcher ->
expects(static::
once()) ->
method('dispatch'
) ->
willReturnOnConsecutiveCalls( static::
isInstanceOf(BuildValidationEvent::
class),
static::
isInstanceOf(NewsletterSubscribeUrlEvent::
class),
static::
isInstanceOf(NewsletterRegisterEvent::
class),
);
$newsletterSubscribeRoute =
new NewsletterSubscribeRoute( $entityRepository,
$this->
createMock(DataValidator::
class),
$eventDispatcher,
$systemConfig,
$this->
createMock(RateLimiter::
class),
$this->
createMock(RequestStack::
class),
);
$newsletterSubscribeRoute->
subscribe($requestData,
$this->salesChannelContext, false
);
}