1
0
mirror of synced 2024-12-13 14:56:01 +03:00

adding functionality to testrunnner to spscify both group name and classname on the command line

This commit is contained in:
meus 2007-09-02 20:59:39 +00:00
parent 810b1d6623
commit 42e76aa7a3

View File

@ -341,7 +341,7 @@ $test->addTestCase(new Doctrine_Template_TestCase());
$test->addTestCase(new Doctrine_Import_Builder_TestCase()); $test->addTestCase(new Doctrine_Import_Builder_TestCase());
$test->addTestCase(new Doctrine_Search_TestCase()); $test->addTestCase(new Doctrine_Search_TestCase());
*/ */
//$test->addTestCase(new Doctrine_IntegrityAction_TestCase()); //$test->addTestCase(new Doctrine_IntegrityAction_TestCase());
//$test->addTestCase(new Doctrine_AuditLog_TestCase()); //$test->addTestCase(new Doctrine_AuditLog_TestCase());
@ -377,7 +377,7 @@ class CliReporter extends HtmlReporter{
class MyReporter extends HtmlReporter { class MyReporter extends HtmlReporter {
public function paintHeader() { public function paintHeader() {
?> ?>
<html> <html>
<head> <head>
<title>Doctrine Unit Tests</title> <title>Doctrine Unit Tests</title>
@ -419,28 +419,31 @@ class MyReporter extends HtmlReporter {
if (PHP_SAPI === "cli") { if (PHP_SAPI === "cli") {
$reporter = new CliReporter(); $reporter = new CliReporter();
} else { } else {
$reporter = new MyReporter(); $reporter = new MyReporter();
} }
$argv = $_SERVER["argv"]; $argv = $_SERVER["argv"];
$coverage = false;
array_shift($argv); array_shift($argv);
$coverage = false;
if(isset($argv[0]) && $argv[0] == "coverage"){ if(isset($argv[0]) && $argv[0] == "coverage"){
array_shift($argv); array_shift($argv);
$coverage = true; $coverage = true;
} }
if( ! empty($argv)) { if( ! empty($argv)) {
$testGroup = new GroupTest("Custom"); $testGroup = new GroupTest("Custom");
foreach($argv as $group) { foreach($argv as $group) {
if( ! isset($$group)) { if( ! isset($$group)) {
if (class_exists($group)) {
$testGroup->addTestCase(new $group);
}
die($group . " is not a valid group of tests\n"); die($group . " is not a valid group of tests\n");
} }
$testGroup->addTestCase($$group); $testGroup->addTestCase($$group);
} }
} else { } else {
$testGroup = $test; $testGroup = $test;
} }
if ($coverage) { if ($coverage) {
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$testGroup->run($reporter); $testGroup->run($reporter);