/** * Create new EventStore instance * * @param ServiceLocatorInterface $serviceLocator * * @return EventStore */ public function createService(ServiceLocatorInterface $serviceLocator) { $globalConfig = array(); $localConfig = array(); $appConfig = $serviceLocator->get('configuration'); if (isset($appConfig['malocher.eventstore'])) { $globalConfig = $appConfig['malocher.eventstore']; } if (file_exists('config/eventstore.config.php')) { $localConfig = (include 'config/eventstore.config.php'); } $esConfig = new Configuration(array_merge($globalConfig, $localConfig)); $esConfig->setEventDispatcher($serviceLocator->get('malocher.eventstore.eventdispatcher')); return new EventStore($esConfig); }
public function testSetEventDispatcher() { $config = new Configuration(array('event_dispatcher' => array('Malocher\\EventStoreTest\\Coverage\\Mock\\MockedEventDispatcher' => array()))); $eventDispatcher = new EventDispatcher(); $config->setEventDispatcher($eventDispatcher); //Ignore array config and return manually set EventDispatcher $this->assertSame($eventDispatcher, $config->getEventDispatcher()); }