=')) { $test_files[] = 'TokenFactoryTest.php'; } sort($test_files); $GLOBALS['HTMLPurifierTest']['Files'] = $test_files; $test_file_lookup = array_flip($test_files); function htmlpurifier_path2class($path) { $temp = $path; $temp = str_replace('./', '', $temp); // remove leading './' $temp = str_replace('.\\', '', $temp); // remove leading '.\' $temp = str_replace('\\', '_', $temp); // normalize \ to _ $temp = str_replace('/', '_', $temp); // normalize / to _ while(strpos($temp, '__') !== false) $temp = str_replace('__', '_', $temp); $temp = str_replace('.php', '', $temp); return $temp; } // use a customized reporter with some helpful UI widgets if (isset($_GET['f']) && isset($test_file_lookup[$_GET['f']])) { $GLOBALS['HTMLPurifierTest']['File'] = $_GET['f']; } else { $GLOBALS['HTMLPurifierTest']['File'] = false; } class HTMLPurifier_SimpleTest_Reporter extends HTMLReporter { function paintHeader($test_name) { parent::paintHeader($test_name); $test_file = $GLOBALS['HTMLPurifierTest']['File']; ?>
addTestClass(htmlpurifier_path2class($path)); } else { $test = new GroupTest('All Tests - HTML Purifier'); foreach ($test_files as $test_file) { $path = 'HTMLPurifier/' . $test_file; require_once $path; $test->addTestClass(htmlpurifier_path2class($path)); } } if (SimpleReporter::inCli()) $reporter = new TextReporter(); else $reporter = new HTMLPurifier_SimpleTest_Reporter('UTF-8'); $test->run($reporter); ?>