| // +----------------------------------------------------------------------+ // // $Id: test.php,v 1.18 2006/10/20 16:36:32 lsmith Exp $ /* This is a small test suite for MDB2 using PHPUnit */ require_once 'test_setup.php'; require_once 'PHPUnit.php'; require_once 'testUtils.php'; require_once 'MDB2.php'; require_once 'HTML_TestListener.php'; function htmlErrorHandler($errno, $errstr, $errfile, $errline) { if ((!$GLOBALS['_show_silenced'] && !error_reporting()) || $errno == 2048) { return; } echo '
';
    errorHandler($errno, $errstr, $errfile, $errline);
    echo '
'; } set_error_handler('htmlErrorHandler'); function htmlErrorHandlerPEAR($error_obj) { echo '
';
    errorHandlerPEAR($error_obj);
    echo '
'; } PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'htmlErrorHandlerPEAR'); MDB2::loadFile('Date'); foreach ($testcases as $testcase) { include_once $testcase.'.php'; } $database = 'driver_test'; $testmethods = !empty($_POST['testmethods']) ? $_POST['testmethods'] : null; if (!is_array($testmethods)) { foreach ($testcases as $testcase) { $testmethods[$testcase] = array_flip(getTests($testcase)); } } ?> MDB2 Tests \n"; echo "
Testing $display_dsn on ".PHP_VERSION."
\n"; $suite = new PHPUnit_TestSuite(); foreach ($testcases as $testcase) { if (isset($testmethods[$testcase]) && is_array($testmethods[$testcase])) { $methods = array_keys($testmethods[$testcase]); foreach ($methods as $method) { $suite->addTest(new $testcase($method)); } } } $result = new PHPUnit_TestResult; $result->addListener(new HTML_TestListener); $suite->run($result); $count = $result->runCount(); $failed = $result->failureCount(); echo "
Summary: $failed failed assertions in $count tests
\n"; echo "\n\n"; } ?>