本文整理汇总了PHP中TestSuite::numTests方法的典型用法代码示例。如果您正苦于以下问题:PHP TestSuite::numTests方法的具体用法?PHP TestSuite::numTests怎么用?PHP TestSuite::numTests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestSuite
的用法示例。
在下文中一共展示了TestSuite::numTests方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
//.........这里部分代码省略.........
$pass = $this->arg($args, ++$i, 'o ' . $name);
}
try {
$method->invoke($instance, $pass);
} catch (TargetInvocationException $e) {
$this->err->writeLine('*** Error for argument ' . $name . ' to ' . $instance->getClassName() . ': ' . $e->getCause()->toString());
return 2;
}
} else {
if ('-?' == $args[$i] || '--help' == $args[$i]) {
return $this->usage();
} else {
if ('-a' == $args[$i]) {
$arguments[] = $this->arg($args, ++$i, 'a');
} else {
if ('--color' == substr($args[$i], 0, 7)) {
$remainder = (string) substr($args[$i], 7);
if (!array_key_exists($remainder, $cmap)) {
throw new IllegalArgumentException('Unsupported argument for --color (must be <empty>, "on", "off", "auto" (default))');
}
$colors = $cmap[$remainder];
} else {
if (strstr($args[$i], '.ini')) {
$sources->add(new xp·unittest·sources·PropertySource(new Properties($args[$i])));
} else {
if (strstr($args[$i], xp::CLASS_FILE_EXT)) {
$sources->add(new xp·unittest·sources·ClassFileSource(new File($args[$i])));
} else {
if (strstr($args[$i], '.**')) {
$sources->add(new xp·unittest·sources·PackageSource(Package::forName(substr($args[$i], 0, -3)), TRUE));
} else {
if (strstr($args[$i], '.*')) {
$sources->add(new xp·unittest·sources·PackageSource(Package::forName(substr($args[$i], 0, -2))));
} else {
if (FALSE !== ($p = strpos($args[$i], '::'))) {
$sources->add(new xp·unittest·sources·ClassSource(XPClass::forName(substr($args[$i], 0, $p)), substr($args[$i], $p + 2)));
} else {
if (is_dir($args[$i])) {
$sources->add(new xp·unittest·sources·FolderSource(new Folder($args[$i])));
} else {
$sources->add(new xp·unittest·sources·ClassSource(XPClass::forName($args[$i])));
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
} catch (Throwable $e) {
$this->err->writeLine('*** ', $e->getMessage());
xp::gc();
return 1;
}
if (isset($coverage)) {
$suite->addListener($coverage);
}
if ($sources->isEmpty()) {
$this->err->writeLine('*** No tests specified');
return 1;
}
// Set up suite
$l = $suite->addListener($listener->newInstance($this->out));
if ($l instanceof ColorizingListener) {
$l->setColor($colors);
}
foreach ($sources as $source) {
try {
$tests = $source->testCasesWith($arguments);
foreach ($tests as $test) {
$suite->addTest($test);
}
} catch (NoSuchElementException $e) {
$this->err->writeLine('*** Warning: ', $e->getMessage());
continue;
} catch (IllegalArgumentException $e) {
$this->err->writeLine('*** Error: ', $e->getMessage());
return 1;
} catch (MethodNotImplementedException $e) {
$this->err->writeLine('*** Error: ', $e->getMessage(), ': ', $e->method, '()');
return 1;
}
}
// Run it!
if (0 == $suite->numTests()) {
return 3;
} else {
$r = $suite->run();
return $r->failureCount() > 0 ? 1 : 0;
}
}
示例2: testRunStarted
/**
* Called when a test run starts.
*
* @param unittest.TestSuite suite
*/
public function testRunStarted(TestSuite $suite)
{
$this->out->writeLine('===> Running test suite (', $suite->numTests(), ' test(s))');
}
示例3: testRunStarted
/**
* Called when a test run starts.
*
* @param unittest.TestSuite suite
*/
public function testRunStarted(TestSuite $suite)
{
$this->sum = $suite->numTests();
$this->cur = 0;
$this->stats = array('failed' => 0, 'errored' => 0, 'warned' => 0, 'skipped' => 0, 'notrun' => 0);
$this->status = TRUE;
}
示例4: testRunStarted
/**
* Called when a test run starts.
*
* @param unittest.TestSuite suite
*/
public function testRunStarted(TestSuite $suite)
{
$this->sum = $suite->numTests();
$this->cur = 0;
}