Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function loadFile($file)
 {
     $initialData = parent::loadFile($file);
     $data = [];
     foreach ($initialData as $section => $subValue) {
         if (!is_array($subValue) || array_keys($subValue) === range(0, count($subValue) - 1)) {
             continue;
         }
         foreach ($subValue as $key => $value) {
             $data[$section . '-' . $key] = $value;
         }
     }
     return $data;
 }
Ejemplo n.º 2
0
 /**
  * bad format
  *
  * @covers Phossa\Config\Loader\IniLoader::load()
  * @expectedException Phossa\Config\Exception\LogicException
  * @expectedExceptionCode Phossa\Config\Message\Message::CONFIG_FORMAT_ERROR
  */
 public function testLoad3()
 {
     $this->assertEquals(['test' => 'wow'], IniLoader::load(__DIR__ . '/conf/config_bad.ini'));
 }
Ejemplo n.º 3
0
 /**
  * Test loading a dir
  */
 public function testLoadDir()
 {
     $data = (object) ['grp1' => (object) ['q' => 'abc', 'b' => 27], 'grp2' => (object) ['a' => 'foobar']];
     $result = $this->loader->load(CONFIGTEST_SUPPORT_PATH . '/test-any');
     $this->assertEquals($data, $result);
 }