Various improvements.
[xhtml-compiler.git] / tests / index.php
blob199c75effe93680bb9de42f2f55707e3c79d8d92
1 <?php
3 // call one file using /?f=FileTest.php , see $test_files array for
4 // valid values
6 error_reporting(E_ALL | E_STRICT);
7 define('XHTMLCompilerTest', 1);
9 $simpletest_location = 'simpletest/'; // reasonable guess
11 // load SimpleTest
12 if(file_exists($f = '../conf/config-test.php')) include $f;
13 if(file_exists($f = '../config-test.php')) include $f;
14 require_once $simpletest_location . 'unit_tester.php';
15 require_once $simpletest_location . 'reporter.php';
16 require_once $simpletest_location . 'mock_objects.php';
18 // note we are using a specially modded version of SimpleTest with strict
19 // support as well as a backported fix in exceptions.php that
20 // ensures tearDown gets called
22 // load our libraries
23 require_once '../common.php';
24 chdir(dirname(__FILE__));
25 Mock::generate('XHTMLCompiler', 'XHTMLCompilerMock');
26 Mock::generate('XHTMLCompiler_PHP', 'XHTMLCompiler_PHPMock');
27 Mock::generate('XHTMLCompiler_DOMFilter', 'XHTMLCompiler_DOMFilterMock');
28 Mock::generate('XHTMLCompiler_TextFilter', 'XHTMLCompiler_TextFilterMock');
29 Mock::generate('XHTMLCompiler_Page', 'XHTMLCompiler_PageMock');
31 require_once 'XHTMLCompilerHarness.php';
32 require_once 'XHTMLCompiler/FileSystemHarness.php';
34 $test = new TestSuite('All Tests - XHTML Compiler');
36 $test->addFile('XHTMLCompiler/FunctionsTest.php');
37 $test->addFile('XHTMLCompiler/PageTest.php');
38 $test->addFile('XHTMLCompiler/ExceptionTest.php');
39 $test->addFile('XHTMLCompiler/FilterManagerTest.php');
40 $test->addFile('XHTMLCompiler/DirectoryTest.php');
42 //if (isset($_GET['full'])) {
43 // these are expensive unit tests
44 $test->addFile('XHTMLCompiler/FileTest.php');
45 //}
47 if (SimpleReporter::inCli()) $reporter = new TextReporter();
48 else $reporter = new HTMLReporter('UTF-8');
50 $test->run($reporter);