Author: chabotc Date: Wed Aug 5 09:59:33 2009 New Revision: 801117 URL: http://svn.apache.org/viewvc?rev=801117&view=rev Log: SHINDIG-1140 by Arne Roomann-Kurrik, adds a set function to the config class used to temporary override config values (useful for overriding the configurable classes in unit tests)
Modified: incubator/shindig/trunk/php/src/common/Config.php Modified: incubator/shindig/trunk/php/src/common/Config.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/Config.php?rev=801117&r1=801116&r2=801117&view=diff ============================================================================== --- incubator/shindig/trunk/php/src/common/Config.php (original) +++ incubator/shindig/trunk/php/src/common/Config.php Wed Aug 5 09:59:33 2009 @@ -53,4 +53,20 @@ throw new ConfigException("Invalid Config Key"); } } + + /** + * Overrides a config value for as long as this object is loaded in memory. + * This allows for overriding certain configuration values for the purposes + * of unit tests. Note that this does not commit a permanent change to the + * configuration files. + * + * @param $key string Configuration key to set the value of. + * @param $value string Value to assign to the specified key. + */ + static function set($key, $value) { + if (! self::$config) { + self::loadConfig(); + } + self::$config[$key] = $value; + } }