mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-04 21:28:06 +02:00
Factor out includes to a "common.php" file, just to tidy up index.php
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1481 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
45
tests/common.php
Normal file
45
tests/common.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
if (!defined('HTMLPurifierTest')) exit;
|
||||
|
||||
// default settings (protect against register_globals)
|
||||
$GLOBALS['HTMLPurifierTest'] = array();
|
||||
$GLOBALS['HTMLPurifierTest']['PEAR'] = false; // do PEAR tests
|
||||
$GLOBALS['HTMLPurifierTest']['PH5P'] = class_exists('DOMDocument');
|
||||
|
||||
// default library settings
|
||||
$simpletest_location = 'simpletest/'; // reasonable guess
|
||||
$csstidy_location = false;
|
||||
|
||||
// load configuration
|
||||
if (file_exists('../conf/test-settings.php')) include '../conf/test-settings.php';
|
||||
if (file_exists('../test-settings.php')) include '../test-settings.php';
|
||||
|
||||
// load SimpleTest
|
||||
require_once $simpletest_location . 'unit_tester.php';
|
||||
require_once $simpletest_location . 'reporter.php';
|
||||
require_once $simpletest_location . 'mock_objects.php';
|
||||
|
||||
// load CSS Tidy
|
||||
if ($csstidy_location !== false) {
|
||||
require_once $csstidy_location . 'class.csstidy.php';
|
||||
require_once $csstidy_location . 'class.csstidy_print.php';
|
||||
}
|
||||
|
||||
// load PEAR to include path
|
||||
if ( is_string($GLOBALS['HTMLPurifierTest']['PEAR']) ) {
|
||||
// if PEAR is true, there's no need to add it to the path
|
||||
set_include_path($GLOBALS['HTMLPurifierTest']['PEAR'] . PATH_SEPARATOR .
|
||||
get_include_path());
|
||||
}
|
||||
|
||||
// after external libraries are loaded, turn on compile time errors
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
// load SimpleTest addons
|
||||
require_once 'HTMLPurifier/SimpleTest/Reporter.php';
|
||||
require_once 'Debugger.php';
|
||||
require_once 'generate_mock_once.func.php';
|
||||
require_once 'path2class.func.php';
|
||||
require_once 'tally_errors.func.php'; // compat
|
||||
|
Reference in New Issue
Block a user