public function testMultipleParamsToHas() { $options = new Ergo_Console_Options(array('x.php', 'file')); $options->define(array('--blargh', ':file')); $this->assertFalse($options->has('-v')); $this->assertTrue($options->has(':file')); $this->assertTrue($options->has('-v', ':file')); }
#!/usr/bin/env php <?php define('BASEDIR', dirname(__FILE__)); require_once BASEDIR . '/classes/Ergo/ClassLoader.php'; $classloader = new Ergo_ClassLoader(); $classloader->register()->includePaths(array(BASEDIR . "/classes", BASEDIR . "/lib/simpletest")); $options = new Ergo_Console_Options($argv, array('--file=false', '--dir=false', '--help', '-h')); // show usage if ($options->has('--help', '-h')) { echo <<<EOM CLI test runner, defaults to running Ergo tests --file <path>\t\tadds a specific test file --dir <path> \tadds a directory containing classes/ and tests/ --help this documentation. EOM; exit(0); } $testFiles = array_filter($options->values('--file')); $dirs = array_filter($options->values('--dir')); // default to this app's tests if (!$options->has('--file', '--dir')) { $dirs[] = BASEDIR; } // add all directories foreach ($dirs as $dir) { $classloader->includePaths(array($dir . '/classes', $dir . '/tests')); } // write an include path