示例#1
0
 public function testConfigWithoutSection()
 {
     $config = new IniFileConfig(dirname(__FILE__) . '/real.conf', dirname(__FILE__) . '/default.conf', $useSections = false);
     self::assertEquals(array('a1' => '1', 'a2' => 'overwritten', 'b1' => '3', 'b2' => 'also overwritten'), $config->getArray());
     self::assertEquals('overwritten', $config->get('a2'));
     self::assertEquals('also overwritten', $config->get('b2', 'section_b'));
     try {
         $config->setDefaultSection('section_b');
         self::fail('Setting a default section when not using sections should throw exception.');
     } catch (ConfigException $e) {
     }
     try {
         $config->get('wrong_variable');
         self::fail('Should have thrown an exception.');
     } catch (ConfigException $e) {
     }
 }