Ejemplo n.º 1
0
 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']);
 }
Ejemplo n.º 2
0
 /**
  * Read from a string and create an array
  *
  * @param string $string String
  *
  * @return array|bool
  */
 public function fromString($string)
 {
     $key = $this->generateKey($string);
     if ($this->storage->hasItem($key)) {
         return $this->storage->getItem($key);
     }
     $config = $this->reader->fromString($string);
     $this->storage->setItem($key, $config);
     return $config;
 }
 public function testFromEmptyString()
 {
     $config = $this->reader->fromString('');
     $this->assertTrue(!$config);
 }
Ejemplo n.º 4
0
 /**
  * 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'] : [];
 }