コード例 #1
0
ファイル: TestDriver.php プロジェクト: umbecr/camilaframework
/**
 * 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;
}
コード例 #2
0
            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();
    $error = $result->errorCount();
    $failure = $result->failureCount();
    $delta = $after - $before;
    $totals['run'] += $run;
    $totals['error'] += $error;