Extends
lithium\console\Command
Runs tests given a path to a directory or file containing tests. The path to the
test(s) may be absolute or relative to the current working directory.
{{{
li3 test lithium/tests/cases/core/ObjectTest.php
li3 test lithium/tests/cases/core
}}}
If you are in the working directory of an application or plugin and wish to run all tests,
simply execute the following:
{{{
li3 test tests/cases
}}}
Parameters
- string $path Absolute or relative path to tests.
Returns
boolean Will exit with status `1` if one or more tests failed otherwise with `0`.Source
public function run($path = null) {
if (!$path = $this->_path($path)) {
return false;
}
$handlers = $this->_handlers;
if (!isset($handlers[$this->format]) || !is_callable($handlers[$this->format])) {
$this->error(sprintf('No handler for format `%s`... ', $this->format));
return false;
}
$filters = $this->filters ? array_map('trim', explode(',', $this->filters)) : array();
$params = compact('filters') + array('reporter' => 'console', 'format' => $this->format);
$runner = function() use ($path, $params) {
error_reporting(E_ALL | E_STRICT | E_DEPRECATED);
return Dispatcher::run($path, $params);
};
$report = $handlers[$this->format]($runner, $path);
$stats = $report->stats();
return $stats['success'];
}