Ejemplo n.º 1
0
    }
    $g = get_group_tests($GLOBALS['tests']);
    if (isset($options['r']) || isset($options['i'])) {
        if (isset($options['r'])) {
            shuffle($random);
            $g = new TestSuite("All Tests (random order)");
        } else {
            if (isset($options['i'])) {
                rsort($random);
                $g = new TestSuite("All Tests (invert order)");
            }
        }
    }
}
/*foreach($random as $file) {
    $g->addTestFile($file);
}*/
if (isset($options['t'])) {
    $reporter = CodendiReporterFactory::reporter('text');
    $g->run($reporter);
} else {
    $j_reporter = CodendiReporterFactory::reporter('junit_xml', true);
    $g->run($j_reporter);
    $xml = $j_reporter->writeXML('codendi_unit_tests_report.xml');
    $j_reporter->generateCoverage('clover.xml');
}
if (isset($options['d'])) {
    echo "Dumping execution order in unit_tests_order.php...";
    file_put_contents('unit_tests_order.php', '<?php' . PHP_EOL . '$random = ' . var_export($random, 1) . ';' . PHP_EOL . '?>');
    echo "\t[ OK ]\n";
}
Ejemplo n.º 2
0
<?php

set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../../../../src' . PATH_SEPARATOR . dirname(__FILE__) . '/../../../../src/www/include');
require_once 'tests_utils.php';
function add_test_to_group($test, $categ, $params)
{
    if (is_array($test)) {
        if ($categ != '_tests') {
            $g =& new GroupTest($categ . ' Results');
            foreach ($test as $c => $t) {
                add_test_to_group($t, $c, array('group' => &$g, 'path' => $params['path'] . "/{$categ}/"));
            }
            $params['group']->addTestCase($g);
        } else {
            foreach ($test as $t) {
                $params['group']->addTestFile($params['path'] . '/' . $t);
            }
        }
    } else {
        if ($test) {
            $params['group']->addTestFile($params['path'] . $categ);
        }
    }
}
/**/
$g =& get_group_tests($GLOBALS['tests']);
exit($g->run(CodendiReporterFactory::reporter("text")) ? 0 : 1);