public function testWriteAndRead() { $config = new Config(array('default' => array('test' => 'foo'))); $this->writer->toFile($this->getTestAssetFileName(), $config); $config = $this->reader->fromFile($this->getTestAssetFileName()); $this->assertEquals('foo', $config['default']['test']); }
/** * Read from a file and create an array * * @param string $filename Filename * * @return array */ public function fromFile($filename) { $absFilename = realpath($filename); $mtime = @filemtime($absFilename); $key = $this->generateKey($mtime . $absFilename); if ($this->storage->hasItem($key)) { return $this->storage->getItem($key); } $config = $this->reader->fromFile($filename); $this->storage->setItem($key, $config); return $config; }
public function testFromFile() { $config = $this->reader->fromFile($this->getTestAssetPath('include-base')); $this->assertEquals('foo', $config['foo']); }
/** * Get an array of build config * @return array */ protected function getBuilds() { $buildFile = $this->getBuildFile(); $config = $this->config->fromFile($buildFile); return isset($config['build']) ? $config['build'] : []; }