예제 #1
0
파일: Config.php 프로젝트: bossrabbit/piwik
 /**
  * Returns a configuration value or section by name.
  *
  * @param string $name The value or section name.
  * @return string|array The requested value requested. Returned by reference.
  * @throws Exception If the value requested not found in either `config.ini.php` or
  *                   `global.ini.php`.
  * @api
  */
 public function &__get($name)
 {
     if (!$this->initialized) {
         $this->reload(array($this->pathGlobal, $this->pathCommon), $this->pathLocal);
         // must be called here, not in init(), since setTestEnvironment() calls init(). (this avoids
         // infinite recursion)
         $allSettings =& $this->settings->getAll();
         Piwik::postTestEvent('Config.createConfigSingleton', array($this, &$allSettings));
     }
     $section =& $this->settings->get($name);
     return $section;
 }
예제 #2
0
 public function test_set_CorrectlySetsSettingValue()
 {
     $fileChain = new IniFileChain();
     $fileChain->set('var', 'value');
     $this->assertEquals(array('var' => 'value'), $fileChain->getAll());
 }