public function testSubscribeServiceStoresTheEventNameAndTheAliasInternally() { $adapter = $this->getMockBuilder(EventPublisherInterface::CLASS)->getMock(); $serviceLocator = $this->getMockBuilder(ServiceManager::CLASS)->getMock(); $serviceLocatorAwareEventPublisher = new ServiceLocatorAwareEventPublisher($adapter, $serviceLocator); $serviceLocatorAwareEventPublisher->subscribeService('abc', 'def'); $this->assertAttributeEquals(['abc' => ['def']], 'events', $serviceLocatorAwareEventPublisher); }
/** * Bootstraps the config for the domain event subscribers for a single * domain. * @param $domain */ protected function bootstrapSubscriberConfig($domain) { if ($domain instanceof SubscriberConfigProviderInterface) { $subscriberConfig = $domain->getSubscriberConfig(); $this->config = array_merge_recursive($this->config, ['subscriber' => $subscriberConfig]); foreach ($subscriberConfig as $alias => $events) { foreach ($events as $event) { $this->eventPublisher->subscribeService($event, $alias); } } } }