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

injectEnvironmentConfiguration() public method

public injectEnvironmentConfiguration ( EnvironmentConfiguration $environmentConfiguration )
$environmentConfiguration Neos\Cache\EnvironmentConfiguration
    public function injectEnvironmentConfiguration(EnvironmentConfiguration $environmentConfiguration)
    {
        $this->environmentConfiguration = $environmentConfiguration;
    }

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());
 }