From: Pierre Habouzit (MadCoder Date: Mon, 13 Dec 2004 11:51:43 +0000 (+0000) Subject: improve tests X-Git-Tag: xorg/old~664 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=7592fe1748bfa4675b80b1145e844a711b699e79;p=platal.git improve tests git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-84 --- diff --git a/htdocs/TESTS/__init__.php b/htdocs/TESTS/__init__.php index f8c8ce5..6e52988 100644 --- a/htdocs/TESTS/__init__.php +++ b/htdocs/TESTS/__init__.php @@ -6,7 +6,8 @@ define('PATH', dirname(__FILE__)); require_once('unit_tester.php'); require_once('mock_objects.php'); require_once('reporter.php'); - require_once('xorg.globals.inc.php'); XorgGlobals::init(); + +$reporter = new HtmlReporter(); ?> diff --git a/htdocs/TESTS/index.php b/htdocs/TESTS/index.php index ef6fb19..45e774e 100644 --- a/htdocs/TESTS/index.php +++ b/htdocs/TESTS/index.php @@ -4,21 +4,48 @@ require_once("__init__.php"); require_once('shell_tester.php'); require_once('mock_objects.php'); -class AllTests extends GroupTest { - function AllTests() { - $this->GroupTest('All tests'); - foreach (glob(PATH.'/*_*.php') as $tfile) { - $this->addTestFile($tfile); - } +class MyReporter extends SimpleReporter { + function MyReporter() { + HtmlReporter::sendNoCacheHeaders(); + $this->SimpleReporter(); + } + + function paintFooter($test_name) { + global $tfile; + $class = $this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green"; + print "
"; + print "

$test_name ("; + print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount(); + print ")

\n"; + print "" . $this->getPassCount() . " passes | "; + print "" . $this->getFailCount() . " fails | "; + print "" . $this->getExceptionCount() . " exceptions."; + print "
\n"; + flush(); } } -$test = &new AllTests(); +$reporter = new MyReporter; +echo << + + ALL TESTS + + + +EOF; -if (SimpleReporter::inCli()) -{ - exit ($test->run(new TextReporter()) ? 0 : 1); +foreach (glob(PATH.'/*_*.php') as $tfile) { + require_once($tfile); } -$test->run(new HtmlReporter()); +print "\n\n"; ?> diff --git a/htdocs/TESTS/xorg_errors.php b/htdocs/TESTS/xorg_errors.php index 524e844..e9cde8d 100644 --- a/htdocs/TESTS/xorg_errors.php +++ b/htdocs/TESTS/xorg_errors.php @@ -29,5 +29,5 @@ class TestOfXOrgErrors extends UnitTestCase { } $test = &new TestOfXOrgErrors(); -$test->run(new HtmlReporter()); +$test->run($reporter); ?> diff --git a/htdocs/TESTS/xorg_user.php b/htdocs/TESTS/xorg_user.php index 7d76067..6540b12 100644 --- a/htdocs/TESTS/xorg_user.php +++ b/htdocs/TESTS/xorg_user.php @@ -57,5 +57,5 @@ class TestOfXOrgUsers extends UnitTestCase { } $test = &new TestOfXOrgUsers(); -$test->run(new HtmlReporter()); +$test->run($reporter); ?>