--colors [1|0] Enable or disable colors. --coverage <path> Generate code coverage report to file. --coverage-src <path> Path to source code. -h | --help This help. XX , array('-c' => array(Cmd::REALPATH => TRUE), '--watch' => array(Cmd::REPEATABLE => TRUE, Cmd::REALPATH => TRUE), '--setup' => array(Cmd::REALPATH => TRUE), 'paths' => array(Cmd::REPEATABLE => TRUE, Cmd::VALUE => getcwd()), '--debug' => array(), '--coverage-src' => array(Cmd::REALPATH => TRUE))); if (isset($_SERVER['argv']) && ($tmp = array_search('-log', $_SERVER['argv']))) { $_SERVER['argv'][$tmp] = '--log'; } $options = $cmd->parse(); Tester\Environment::$debugMode = (bool) $options['--debug']; if (isset($options['--colors'])) { Tester\Environment::$useColors = (bool) $options['--colors']; } elseif ($options['--tap']) { Tester\Environment::$useColors = FALSE; } if ($cmd->isEmpty() || $options['--help']) { $cmd->help(); exit; } $phpArgs = ''; if ($options['-c']) { $phpArgs .= ' -c ' . Tester\Helpers::escapeArg($options['-c']); } elseif (!$options['--info']) { echo "Note: No php.ini is used.\n"; } foreach ($options['-d'] as $item) { $phpArgs .= ' -d ' . Tester\Helpers::escapeArg($item); } $php = new Tester\Runner\PhpExecutable($options['-p'], $phpArgs);
require __DIR__ . '/Runner/OutputHandler.php'; require __DIR__ . '/Runner/Output/Logger.php'; require __DIR__ . '/Runner/Output/TapPrinter.php'; require __DIR__ . '/Runner/Output/ConsolePrinter.php'; require __DIR__ . '/Framework/Helpers.php'; require __DIR__ . '/Framework/Environment.php'; require __DIR__ . '/Framework/Assert.php'; require __DIR__ . '/Framework/Dumper.php'; require __DIR__ . '/Framework/DataProvider.php'; use Tester\Runner\CommandLine as Cmd; Tester\Environment::setup(); $cmd = new Cmd("\nNette Tester (v0.9.5)\n---------------------\nUsage:\n\ttester.php [options] [<test file> | <directory>]...\n\nOptions:\n\t-p <path> Specify PHP executable to run (default: php-cgi).\n\t-c <path> Look for php.ini in directory <path> or use <path> as php.ini.\n\t-log <path> Write log to file <path>.\n\t-d <key=value>... Define INI entry 'key' with value 'val'.\n\t-s Show information about skipped tests.\n\t--tap Generate Test Anything Protocol.\n\t-j <num> Run <num> jobs in parallel.\n\t-w | --watch <path> Watch directory.\n\t--colors [1|0] Enable or disable colors.\n\t-h | --help This help.\n\n", array('-c' => array(Cmd::REALPATH => TRUE), '--watch' => array(Cmd::REPEATABLE => TRUE, Cmd::REALPATH => TRUE), 'paths' => array(Cmd::REPEATABLE => TRUE, Cmd::VALUE => getcwd()), '--debug' => array())); $options = $cmd->parse(); Tester\Environment::$debugMode = (bool) $options['--debug']; if (isset($options['--colors'])) { Tester\Environment::$useColors = (bool) $options['--colors']; } if ($cmd->isEmpty() || $options['--help']) { $cmd->help(); exit; } $phpArgs = $options['-c'] ? '-n -c ' . escapeshellarg($options['-c']) : '-n'; foreach ($options['-d'] as $item) { $phpArgs .= ' -d ' . escapeshellarg($item); } $runner = new Tester\Runner\Runner(new Tester\Runner\PhpExecutable($options['-p'], $phpArgs)); $runner->paths = $options['paths']; $runner->jobCount = max(1, (int) $options['-j']); $runner->outputHandlers[] = $options['--tap'] ? new Tester\Runner\Output\TapPrinter($runner) : new Tester\Runner\Output\ConsolePrinter($runner, $options['-s']); if ($options['-log']) { echo "Log: {$options['-log']}\n";