示例#1
0
文件: ConfigTest.php 项目: visor/nano
 public function testSettingConfigValueInRuntime()
 {
     $config = new \Nano\Application\Config($this->files->get($this, '/configs/default'), new \Nano\Application\Config\Format\Php());
     self::assertFalse($config->exists('section'));
     $config->set('section', 'value');
     self::assertTrue($config->exists('section'));
     self::assertEquals('value', $config->get('section'));
 }
示例#2
0
 public function testApplicationInstanceShoultBeAvailableInConfigSource()
 {
     $path = $this->files->get($this, '/settings');
     $this->builder->setSource($this->files->get($this, '/application'));
     $this->builder->setDestination($path);
     $this->builder->build('default');
     self::assertFileExists($path . DS . \Nano\Application\Config::CONFIG_FILE_NAME);
     self::assertFileExists($path . DS . \Nano\Application\Config::ROUTES_FILE_NAME);
     $config = new \Nano\Application\Config($path, $this->application->configFormat);
     self::assertTrue($config->exists('config'));
     self::assertInstanceOf('stdClass', $config->get('config'));
     self::assertObjectHasAttribute('root', $config->get('config'));
     self::assertEquals($this->application->rootDir, $config->get('config')->root);
 }