コード例 #1
0
ファイル: Suite.php プロジェクト: robtuley/knotwerk
 function testExecuteMethodExecutesChildTests()
 {
     $suite = new T_Unit_Suite();
     $suite->addChild(new T_Test_Unit_CaseStub());
     $suite->addChild(new T_Test_Unit_CaseStub());
     $observer = new T_Test_Unit_ObserverStub();
     $suite->attach($observer);
     $suite->execute();
     $this->assertSame(8, count($observer->getLog()));
 }
コード例 #2
0
ファイル: test.php プロジェクト: robtuley/knotwerk
if (count($classes) == 0 && count($packages) == 0) {
    $dir = new T_File_Dir(T_ROOT_DIR);
    foreach ($dir as $sub) {
        if (!$sub instanceof T_File_Dir) {
            continue;
        }
        $ds = DIRECTORY_SEPARATOR;
        $name = _end(explode($ds, rtrim($sub->__toString(), $ds)));
        if (ctype_alpha(substr($name, 0, 1))) {
            $packages[] = $name;
        }
    }
    // @todo add docs
}
// build test suite
$suite = new T_Unit_Suite();
foreach ($packages as $p) {
    if (strpos($p, '_docs') !== false) {
        // bootstraps docs area
        require_once T_ROOT_DIR . '_docs/.engine/bootstrap' . T_PHP_EXT;
        $suite->addChild(new T_Unit_Directory(ENGINE_DIR . 'Test', 'Test'));
    } else {
        $suite->addChild(new T_Unit_PackageSuite($p));
    }
}
foreach ($classes as $c) {
    $test = 'T_Test_' . substr($c, 2);
    if (class_exists($test)) {
        $suite->addChild(new $test());
    }
}