/** * @param CacheService $cacheService * @param ModuleOptions $options * @param ServiceLocatorInterface $serviceLocator */ protected function attachStrategiesToEventManager(CacheService $cacheService, ModuleOptions $options, ServiceLocatorInterface $serviceLocator) { // Register enabled strategies on the cacheListener $strategies = $options->getStrategies(); if (isset($strategies['enabled'])) { /** @var $strategyPluginManager \StrokerCache\Strategy\CacheStrategyPluginManager */ $strategyPluginManager = $serviceLocator->get('StrokerCache\\Strategy\\CacheStrategyPluginManager'); foreach ($strategies['enabled'] as $alias => $options) { if (is_numeric($alias)) { $alias = $options; } $strategy = $strategyPluginManager->get($alias, $options); if ($strategy instanceof ListenerAggregateInterface) { $listener = $strategy; } else { $listener = new ShouldCacheStrategyListener($strategy); } $cacheService->getEventManager()->attach($listener); } } }
public function testGetSetIdGenerator() { $this->options->setIdGenerator('foo'); $this->assertEquals('foo', $this->options->getIdGenerator()); }