<?php

error_reporting(E_ALL | E_STRICT);

ini_set('include_path',ini_get('include_path').";.;" . $_GET['phpUnitPath'] . ';' . dirname($_GET['allTestsFile']) . ';');

require_once 'PHPUnit/Util/Filter.php';

PHPUnit_Util_Filter::addFileToFilter(__FILE__);

if (!defined('PHPUnit_MAIN_METHOD')) {
    define('PHPUnit_MAIN_METHOD', 'PHPEdit_AllTests::main');
    chdir(dirname(__FILE__));
}

require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/TextUI/TestRunner.php';

require_once 'PHPEdit_ResultPrinter.php';
require_once 'PHPEdit_TestRunner.php';

require_once $_GET['allTestsFile'];

class PHPEdit_AllTests
{
    public static function main()
    {
        $parameters = array();
		$parameters['printer'] = new PHPEdit_ResultPrinter();

        if (defined('PHPUNIT_TESTSUITE_GENERATE_REPORT') && PHPUNIT_TESTSUITE_GENERATE_REPORT && extension_loaded('xdebug')) {
            $parameters['reportDirectory'] = PHPUNIT_TESTSUITE_REPORT_TARGET;
        }

        PHPEdit_TestRunner::run(self::suite(), $parameters);
    }

    public static function suite()
    {
        $suite = new PHPUnit_Framework_TestSuite('PHPUnit');

		eval("\$childSuite = {$_GET['allTestsName']}::suite();");
        $suite->addTest($childSuite);

        return $suite;
    }
}

if (is_readable(dirname(__FILE__) . '/TestConfiguration.php')) {
    require_once 'TestConfiguration.php';
} else if (is_readable(dirname(__FILE__) . '/TestConfiguration.php')) {
    require_once 'PHPUnit/Tests/TestConfiguration.php.dist';
}

if (defined('PHPUNIT_TESTSUITE_GENERATE_REPORT') && PHPUNIT_TESTSUITE_GENERATE_REPORT && extension_loaded('xdebug')) {
    xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
}

if (PHPUnit_MAIN_METHOD == 'PHPEdit_AllTests::main') {
    PHPEdit_AllTests::main();
}

?>
