コード例 #1
0
 */
require_once 'init.php';
require_once MAX_PATH . '/lib/OA/DB.php';
require_once MAX_PATH . '/tests/xmlreporter.php';
require_once MAX_PATH . '/tests/testClasses/TestFiles.php';
if ($_SERVER['argc'] < 2) {
    echo "Usage: " . __FILE__ . " php-command [unit|integration]";
    exit(1);
}
$php = $_SERVER['argv'][1];
$testName = isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : "";
$aLayer = array('unit', 'integration');
// Take a copy in memory of the conf file
$testConfFile = dirname(__FILE__) . '/../var/test.conf.php';
$testConf = file_get_contents($testConfFile);
$oReporter = new ReviveXmlReporter();
$oReporter->paintGroupStart("Tests", count($aLayer));
foreach ($aLayer as $layer) {
    $aTestFiles = TestFiles::getAllTestFiles($layer);
    $oReporter->paintGroupStart("Layer {$layer}", count($aTestFiles));
    foreach ($aTestFiles as $subLayer => $aDirectories) {
        $oReporter->paintGroupStart("Sublayer {$subLayer}", count($aDirectories));
        foreach ($aDirectories as $dirName => $aFiles) {
            $oReporter->paintGroupStart("Directory {$dirName} ({$testName})", count($aFiles));
            foreach ($aFiles as $fileName) {
                $oReporter->paintCaseStart("File {$fileName} ({$testName})");
                // Prepare the name of the test to display when running
                for ($counter = 0; $counter < count($GLOBALS['_MAX']['TEST']['groups']) - 1; $counter++) {
                    if ($layer == $GLOBALS['_MAX']['TEST']['groups'][$counter]) {
                        $layerDisplayName = $GLOBALS['_MAX']['TEST'][$GLOBALS['_MAX']['TEST']['groups'][$counter] . '_layers'][$subLayer][0];
                    }