Neos\Flow\Cache\CacheFactory::injectCacheManager PHP Method

injectCacheManager() public method

public injectCacheManager ( CacheManager $cacheManager )
$cacheManager CacheManager
    public function injectCacheManager(CacheManager $cacheManager)
    {
        $this->cacheManager = $cacheManager;
    }

Usage Example

 /**
  * @test
  */
 public function aDifferentDefaultCacheDirectoryIsUsedForPersistentFileCaches()
 {
     $cacheManager = new CacheManager();
     $factory = new CacheFactory(new ApplicationContext('Testing'), $this->mockEnvironment);
     $factory->injectCacheManager($cacheManager);
     $factory->injectEnvironmentConfiguration($this->mockEnvironmentConfiguration);
     $cache = $factory->create('Persistent_Cache', VariableFrontend::class, FileBackend::class, [], true);
     // We need to create the directory here because vfs doesn't support touch() which is used by
     // createDirectoryRecursively() in the setCache method.
     mkdir('vfs://Temporary/Directory/Cache');
     $this->assertEquals(FLOW_PATH_DATA . 'Persistent/Cache/Data/Persistent_Cache/', $cache->getBackend()->getCacheDirectory());
 }