public function testListeners()
{
$options = ['mail_listeners' => [new MailListenerMock(), 'mail_listener_service', 'AcMailerTest\\Event\\MailListenerMock']];
$this->initServiceLocator($options);
$this->serviceLocator->set('mail_listener_service', new MailListenerMock());
/** @var EventManagerAwareInterface $mailService */
$mailService = $this->mailServiceFactory->__invoke($this->serviceLocator, 'acmailer.mailservice.default');
// Make getListenersByEventName method public
$em = $mailService->getEventManager();
$refObject = new \ReflectionObject($em);
$method = $refObject->getMethod('getListenersByEventName');
$method->setAccessible(true);
$this->assertCount(3, $method->invoke($em, MailEvent::EVENT_MAIL_PRE_SEND));
}