示例#1
0
文件: ConfigTest.php 项目: visor/nano
 public function testLoadShouldUseEmptyStdClassWhenConfigIsEmpty()
 {
     $config = new \Nano\Application\Config($this->files->get($this, '/configs/empty-array'), new \Nano\Application\Config\Format\Php());
     self::assertNull($config->name());
     self::assertEquals(new stdClass(), self::getObjectProperty($config, 'config'));
 }
示例#2
0
 public function testLoadingConfigurationWithoutParents()
 {
     $path = $this->files->get($this, '/settings');
     $this->builder->setSource($this->files->get($this, '/no-parents'));
     $this->builder->setDestination($path);
     $this->builder->build('default');
     self::assertFileExists($path . DS . \Nano\Application\Config::CONFIG_FILE_NAME);
     $config = new \Nano\Application\Config($path, $this->application->configFormat);
     $expected = (object) array('file1' => (object) array('file1-param1' => 'value1'), 'file2' => (object) array('file2-param1' => 'value1'), '__name' => 'default');
     self::assertTrue($config->exists('file1'));
     self::assertTrue($config->exists('file2'));
     self::assertEquals('default', $config->name());
     self::assertEquals($expected, self::getObjectProperty($config, 'config'));
 }