cvs: pear /MDB/tests HTML_TestListener.php clitest.php test.php tests.css

From: Date: Mon, 03 Feb 2003 15:58:30 +0000
Subject: cvs: pear /MDB/tests HTML_TestListener.php clitest.php test.php tests.css
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8705@lists.php.net to get a copy of this message
pgc Mon Feb 3 10:58:30 2003 EDT Modified files: /pear/MDB/tests test.php clitest.php HTML_TestListener.php tests.css Log: * fixed error when testing multiple dsns * tried to make the HTML output a little nicer (in my own div'y way :) * added a start and end test line in clitest.php output Index: pear/MDB/tests/test.php diff -u pear/MDB/tests/test.php:1.16 pear/MDB/tests/test.php:1.17 --- pear/MDB/tests/test.php:1.16 Sat Jan 18 16:34:26 2003 +++ pear/MDB/tests/test.php Mon Feb 3 10:58:30 2003 @@ -41,7 +41,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: test.php,v 1.16 2003/01/18 21:34:26 lsmith Exp $ +// $Id: test.php,v 1.17 2003/02/03 15:58:30 pgc Exp $ /* This is a small test suite for MDB using PHPUnit @@ -61,6 +61,7 @@ require_once('test_setup.php'); require_once('testUtils.php'); require_once('MDB.php'); +require_once('HTML_TestListener.php'); // you may need to uncomment the line and modify the multiplier as you see fit // set_time_limit(120*count($dbarray)); @@ -82,7 +83,14 @@ } } -$suite = new PHPUnit_TestSuite(); +?> +<html> +<head> +<title>MDB Tests</title> +<link href="tests.css" rel="stylesheet" type="text/css"> +</head> +<body> +<?php foreach ($dbarray as $db) { $dsn = $db['dsn']; @@ -92,6 +100,12 @@ } $options = $db['options']; + $display_dsn = $dsn['phptype'] . "://" . $dsn['username'] . ":" . $dsn['password'] . "@" . $dsn['hostspec'] . "/" . $dsn['database']; + echo "<div class=\"test\">\n"; + echo "<div class=\"title\">Testing $display_dsn</div>\n"; + + $suite = new PHPUnit_TestSuite(); + foreach ($testcases as $testcase) { if (is_array($testmethods[$testcase])) { $methods = array_keys($testmethods[$testcase]); @@ -100,23 +114,12 @@ } } } -} -require_once('HTML_TestListener.php'); -$result = new PHPUnit_TestResult; -$result->addListener(new HTML_TestListener); - -?> -<html> -<head> -<title>MDB Tests</title> -<link href="tests.css" rel="stylesheet" type="text/css"> -</head> -<body> - -<?php -$suite->run($result); + $result = new PHPUnit_TestResult; + $result->addListener(new HTML_TestListener); + $suite->run($result); + echo "\n</div>\n"; +} ?> - </body> </html> Index: pear/MDB/tests/clitest.php diff -u pear/MDB/tests/clitest.php:1.5 pear/MDB/tests/clitest.php:1.6 --- pear/MDB/tests/clitest.php:1.5 Sat Jan 18 16:35:19 2003 +++ pear/MDB/tests/clitest.php Mon Feb 3 10:58:30 2003 @@ -71,6 +71,7 @@ require_once('test_setup.php'); require_once('testUtils.php'); require_once('MDB.php'); +require_once('Console_TestListener.php'); MDB::loadFile('Manager'); MDB::loadFile('Date'); @@ -100,16 +101,19 @@ } } -$suite = new PHPUnit_TestSuite(); - foreach ($dbarray as $db) { $dsn = $db['dsn']; // if the database name isn't set in the dsn use the default - if (empty($dsn['database']) { + if (empty($dsn['database'])) { $dsn['database'] = $database; } $options = $db['options']; + $display_dsn = $dsn['phptype'] . "://" . $dsn['username'] . ":" . $dsn['password'] . "@" . $dsn['hostspec'] . "/" . $dsn['database']; + echo "=== Start test of $display_dsn ===\n"; + + $suite = new PHPUnit_TestSuite(); + foreach ($testcases as $testcase) { if (is_array($testmethods[$testcase])) { $methods = array_keys($testmethods[$testcase]); @@ -118,11 +122,13 @@ } } } -} -require_once('Console_TestListener.php'); -$result = new PHPUnit_TestResult; -$result->addListener(new Console_TestListener); + $result = new PHPUnit_TestResult; + $result->addListener(new Console_TestListener); + + $suite->run($result); + + echo "=== End test of $display_dsn ===\n\n"; +} -$suite->run($result); ?> Index: pear/MDB/tests/HTML_TestListener.php diff -u pear/MDB/tests/HTML_TestListener.php:1.3 pear/MDB/tests/HTML_TestListener.php:1.4 --- pear/MDB/tests/HTML_TestListener.php:1.3 Sat Jan 18 16:35:19 2003 +++ pear/MDB/tests/HTML_TestListener.php Mon Feb 3 10:58:30 2003 @@ -9,17 +9,17 @@ function addFailure(&$test, &$t) { $this->_fails += 1; if ($this->_fails == 1) { - echo('<div class="failure">'); + echo("\n<div class=\"failure\">"); } - echo("Failure $this->_fails : $t<br>"); + echo("Failure $this->_fails : $t<br>\n"); } function endTest(&$test) { if ($this->_fails == 0 && $this->_errors == 0) { echo(' Test passed'); } else { - echo("There were $this->_fails failures for ".$test->getName().'</br>'); - echo("There were $this->_errors errors for ".$test->getName().'</div>'); + echo("There were $this->_fails failures for ".$test->getName()."</br>\n"); + echo("There were $this->_errors errors for ".$test->getName()."</div>\n"); } echo('</div>'); } @@ -27,7 +27,7 @@ function startTest(&$test) { $this->_fails = 0; $this->_errors = 0; - echo("\n<div class=\"test\">".get_class($test).' : Starting '.$test->getName().' ...'); + echo("\n<div class=\"testcase\">".get_class($test).' : Starting '.$test->getName().' ...'); } } Index: pear/MDB/tests/tests.css diff -u pear/MDB/tests/tests.css:1.1 pear/MDB/tests/tests.css:1.2 --- pear/MDB/tests/tests.css:1.1 Mon Oct 28 10:08:02 2002 +++ pear/MDB/tests/tests.css Mon Feb 3 10:58:30 2003 @@ -6,13 +6,31 @@ div.failure { border: 2px #FF0000 solid; + margin : 1em; +} h1 { font-size: x-small } +div.test { + border : 1px #000000 solid; + width : 100%; + margin-top : 1em; + padding : 2px; +} + +.title { + top : 0px; + left : 0px; + text-align : center; + background : #000000; + color : #FFFFFF; + padding : 4px; +} + div.testlineup { border: 2px #000000 solid; } -} +

« previous php.pear.cvs (#8705) next »