/** * Return the value of a config option * @param string option name * @return mixed option value (null if not set) */ public function getConfigOption($option) { return $this->config->get($option); }
/** * test epConfig merge: different options * same options but different values */ function testConfigMergeDiff2() { // create cfg1 $cfg1 = new epConfig(); $this->assertTrue($cfg1 != null); // create cfg2 $cfg2 = new epConfig(); $this->assertTrue($cfg2 != null); // set same options/values to cfg1 and cfg2 for ($i = 0; $i < 10; $i++) { // set an option-value pair $option = 'option' . $i; $value_set = 'cfg1_value' . $i; // cfg1 set/get option $cfg1->set($option, $value_set); $value_get = $cfg1->get($option); $this->assertTrue($value_set == $value_get); $value_set = 'cfg2_value' . $i; // cfg2 set/get option $cfg2->set($option, $value_set); $value_get = $cfg2->get($option); $this->assertTrue($value_set == $value_get); } // merge cfg2 to cfg1 $cfg1->merge($cfg2); // since options in cfg2 are the same, cfg1 should not be changed // set same options/values to cfg1 and cfg2 for ($i = 0; $i < 10; $i++) { // values from cfg2 now have overridden cfg1's $option = 'option' . $i; $value_set = 'cfg2_value' . $i; $value_get = $cfg1->get($option); $this->assertTrue($value_set == $value_get); } }