<?php

require_once 'Wact/Loader.inc.php';
Wact_Loader::setupWact();

// Load SimpleTest
if (is_resource($fh = @fopen('simpletest/unit_tester.php', 'r', true))) {
    fclose($fh);
} else {
?>
<html>
<head>
<title>SimpleTest cannot be located</title>
</head>
<body>
<h1>SimpleTest Cannot Be Located</h1>
<p>
The WACT test runner requires <a href="http://simpletest.sourceforge.net/">SimpleTest</a>.  SimpleTest must be available in the
PHP <code>include_path</code> under the directory <code>simpletest</code>.
</p>
<p>
The current <code>include_path</code> is '<?Php htmlspecialchars(get_include_path()); ?>'.
</p>
</body>
</html>
<?php
exit;
}

require_once 'simpletest/unit_tester.php';

// Load WACT
if (is_resource($fh = @fopen('Wact/Test/ui/web.inc.php', 'r', true))) {
    fclose($fh);
} else {
?>
<html>
<head>
<title>WACT cannot be located</title>
</head>
<body>
<h1>WACT Cannot Be Located</h1>
The WACT framework cannot be located. The framework must be available in the 
PHP <code>include_path</code> under the directory <code>wact</code>.
</body>
</html>
<?php
exit;
}

require_once 'Wact/Test/ui/web.inc.php';
require_once 'Wact/Test/config.inc.php';

$project = Wact_Tool_Project::Load(dirname(__FILE__));
$project->test_runner = new WactTestRunnerConfig();

$runner = new WebTestRunningInterface(
    $project->test_runner,
    new Wact_Test_Collector());
$runner->start();

?>