/** * Load the tests that are defined in the named modules. * * If you have Tests/Foo.php which defines a test class called * Tests_Foo, the call would look like: * * loadTests('Tests/', array('Foo')) * * @param string $test_dir The root of the test hierarchy. Must end * with a / * * @param array $test_names The names of the modules in which the * tests are defined. This should not include the root of the test * hierarchy. */ function loadTests($test_dir, $test_names) { global $_tests; $suites = array(); foreach ($test_names as $filename) { $filename = $test_dir . $filename . '.php'; $class_name = str_replace('/', '_', $filename); $class_name = basename($class_name, '.php'); if (!global_require_once($filename)) { continue; } $test = new $class_name($class_name); if (is_a($test, 'PHPUnit_TestCase')) { $s = new PHPUnit_TestSuite(); $s->setName($class_name); $s->addTestSuite($class_name); $test = $s; $tc_array_name = $class_name . '_other'; if (array_key_exists($tc_array_name, $GLOBALS) && is_array($GLOBALS[$tc_array_name])) { foreach ($GLOBALS[$tc_array_name] as $tc) { $test->addTestSuite(get_class($tc)); } } } $suites[] = $test; } return $suites; }
/** * Load the tests that are defined in the named modules. * * If you have Tests/Foo.php which defines a test class called * Tests_Foo, the call would look like: * * loadTests('Tests/', array('Foo')) * * @param string $test_dir The root of the test hierarchy. Must end * with a / * * @param array $test_names The names of the modules in which the * tests are defined. This should not include the root of the test * hierarchy. */ function loadTests($test_dir, $test_names) { global $_tests; $suites = array(); foreach ($test_names as $filename) { $filename = $test_dir . $filename . '.php'; if (!global_require_once($filename)) { continue; } $class_name = str_replace('/', '_', $filename); $class_name = basename($class_name, '.php'); $suites[] = makeSuite($class_name); } return $suites; }
/** * Load the tests that are defined in the named modules. * * If you have Tests/Foo.php which defines a test class called * Tests_Foo, the call would look like: * * loadTests('Tests/', array('Foo')) * * @param string $test_dir The root of the test hierarchy. Must end * with a / * * @param array $test_names The names of the modules in which the * tests are defined. This should not include the root of the test * hierarchy. */ function loadTests($test_dir, $test_names) { $suites = array(); foreach ($test_names as $filename) { $filename = $test_dir . $filename . '.php'; $class_name = str_replace(DIRECTORY_SEPARATOR, '_', $filename); $class_name = basename($class_name, '.php'); global_require_once($filename); $test = new $class_name($class_name); if (is_a($test, 'PHPUnit_TestCase')) { $test = new PHPUnit_TestSuite($class_name); } $suites[] = $test; } return $suites; }
$found = true; break; } } if (!$found) { print "Unknown math library specified: {$lib}\n"; exit(1); } } $_Auth_OpenID_math_extensions = $new_extensions; } // ******** End math library selection ********** $suites = loadSuite($tests_to_run); // ******** Load additional test suites ******** foreach ($extra_test_modules as $filename) { if (!global_require_once($filename)) { continue; } $module_name = basename($filename, '.php'); $class_name = "Tests_Auth_OpenID_{$module_name}_Test"; $suites[] = makeSuite($class_name); } $totals = array('run' => 0, 'error' => 0, 'failure' => 0, 'time' => 0); foreach ($suites as $suite) { $name = $suite->getName(); echo "==========================================\nTest suite: {$name}\n------------------------------------------\n"; $result = new TextTestResult(); $before = microtime_float(); $suite->run($result); $after = microtime_float(); $run = $result->count();