Permalink
Browse files

updating to allow for specifying a configuration path via the load() …

…method. update to paramtest to use this feature. added APPLICATION_PATH to the test bootstrap
  • Loading branch information...
enygma committed Jan 7, 2012
1 parent 8b89528 commit 520e49fe2d9ee829bf15b66646b60dbab2805d02
Showing with 28 additions and 6 deletions.
  1. +14 −2 Lib/Config.php
  2. +1 −1 tests/Lib/Task/Documentation/DocbloxTest.php
  3. +11 −3 tests/Lib/Task/Internal/ParamTest.php
  4. +2 −0 tests/bootstrap.php
View
@@ -48,10 +48,10 @@ class Config
* @throws Exception
* @return void
*/
- public static function load()
+ public static function load($configPath=null)
{
// look for a configuration file
- $configFilePath = self::$_configFile;
+ $configFilePath = (($configPath !== null) ? $configPath : '').self::$_configFile;
// see if we have a config file option on the command line
$path = \Usher\Lib\Console::getOption('configFilePath');
@@ -108,6 +108,18 @@ public function getOption($optionPath)
$ex = new Utility\ExpandObject();
return $ex->find(self::$_currentConfig, $optionPath, '.');
}
+
+ /**
+ * Set the path to the configuration file
+ *
+ * @param string $configPath Path to directory containing configuration file
+ *
+ * @return void
+ */
+ public function setConfigFilePath($configPath)
+ {
+ $this->_configFile = $configPath.'/'.$this->_configFile;
+ }
}
?>
@@ -13,7 +13,7 @@ public function setUp()
}
public function tearDown()
{
-
+ unset($this->_task);
}
/**
@@ -13,18 +13,26 @@ public function setUp()
}
public function tearDown()
{
-
+ unset($this->_task);
}
/**
- * Options not found in task project data
+ * Options not found/loaded in task project data
*
* @expectedException Exception
*/
- public function testOptionsNotFound()
+ public function testOptionsNotLoaded()
{
$this->_task->execute();
}
+
+ /**
+ * Options are not found in task project data
+ */
+ public function testOptionsNotFound()
+ {
+ \Usher\Lib\Config::load(APPLICATION_PATH.'/');
+ }
}
?>
View
@@ -6,5 +6,7 @@
require_once __DIR__.'/../Lib/Loader.php';
$baseDir = str_replace('/tests', '', __DIR__);
+define('APPLICATION_PATH',$baseDir);
+
Lib\Loader::init($baseDir);
?>

0 comments on commit 520e49f

Please sign in to comment.