/** * Load the configuration files. * * If `loadFromCache` doesn't return false (meaning the configuration groups * were loaded from the cache), then the registry is returned straight away * and the filesystem loading is bypassed. * * If the configuration groups could not be loaded from the cache, then * `load()` on the parent class is called, loading and compiling the * configuration groups from the filesystem. They are then cached for speedy * retrieval next time. * * @see loadByCache * @see parent::load() * * @param Registry $registry The configuration registry to add compiled * configurations to * @return Registry The same registry is returned */ public function load(Registry $registry) { if ($this->loadFromCache($registry)) { return $registry; } $return = parent::load($registry); $this->_cache->store($this->_cacheKey, $registry->getAll()); return $return; }
/** * @expectedException Message\Cog\Config\Exception * @expectedExceptionMessage Config file `vfs://config/myconfig.yml` is not readable */ public function testExceptionThrownWhenConfigFileNotReadable() { vfsStream::setup('config'); vfsStream::newFile('myconfig.yml', 0333)->at(vfsStreamWrapper::getRoot()); $env = new FauxEnvironment(); $env->set('staging'); $loader = new Loader(vfsStream::url('config'), $env); $registry = new NonLoadingRegistry($loader); $loader->load($registry); }