示例#1
0
 public function testFactoryPhp()
 {
     // Given: ConfigFactory
     $factory = new ConfigFactory();
     // Given: Config build with ConfigFactory from PHP file
     $config = $factory->buildFromPath(DATA_PATH . '/config/base.php');
     // Then: Expect to config parameter foo be equal to bar
     $this->assertSame('bar', $config->get('foo'));
     // Then: Expect to config parameter foo be equal to bar
     $this->assertSame('foo', $config->section->bar);
 }
示例#2
0
 /**
  * @param string $file
  */
 public function load($file)
 {
     $config = $this->cache->get($file);
     if (null === $config) {
         $config = $this->factory->buildFromPath($file);
         $this->cache->set($file, $config->toArray());
     } else {
         $config = new Config($config);
     }
     if ($config) {
         $this->config->merge($config);
     }
     return $this;
 }