/** * Main dispatch routine * * @param integer $argc number of arguments * @param array $argv arguments * * @return boolean True if success; false otherwise */ public static function main($argc, $argv) { set_error_handler(array('WebDriver\\WebTest\\WebTest', 'exception_error_handler')); assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_WARNING, 0); assert_options(ASSERT_CALLBACK, array('WebDriver\\WebTest\\WebTest', 'assert_handler')); /* * parse command line options */ if ($argc === 1) { $argc++; array_push($argv, '-h'); } for ($i = 1; $i < $argc; $i++) { $opt = $argv[$i]; $optValue = ''; if (preg_match('~([-]+[^=]+)=(.+)~', $opt, $matches)) { $opt = $matches[1]; $optValue = $matches[2]; } switch ($opt) { case '-h': case '--help': echo $argv[0] . " [-d directory] [--tap] [--xml] [--disable-screenshot] test.php\n"; exit(1); case '-d': case '--output-directory': case '--format': case '--tap': case '--xml': case '--disable-screenshot': default: } } echo "TAP version 13\n"; $success = false; try { $webtest = new self(); $success = $webtest->runTests($argv[1]); } catch (\Exception $e) { echo 'Bail out! ' . $e->getMessage() . "\n"; } return $success; }