<?php
/**
 * @category   Zend
 * @package    Bgy
 * @subpackage UnitTests
 */

/**
 * Include PHPUnit dependencies
 */
require_once 'PHPUnit/Runner/Version.php';

$phpunitVersion = PHPUnit_Runner_Version::id();
if ($phpunitVersion == '@package_version@' || version_compare($phpunitVersion, '3.5.5', '>=')) {
    if (version_compare($phpunitVersion, '3.6.0', '>=')) {
        echo 'This version of PHPUnit is not supported in Zend Framework 1.x unit tests.';
        exit(1);
    }
    require_once 'PHPUnit/Autoload.php'; // >= PHPUnit 3.5.5
} else {
    require_once 'PHPUnit/Framework.php'; // < PHPUnit 3.5.5
}

/*
 * Set error reporting to the level to which Zend Framework code must comply.
 */
error_reporting(E_ALL | E_STRICT);

/*
 * Determine the root, library, and tests directories of the framework
 * distribution.
 */
$bgyRoot        = realpath(dirname(dirname(__FILE__)));
$zfCoreLibrary = '/usr/local/zend/share/ZendFramework/library/';
$bgyCoreLibrary = "$bgyRoot/library";
$bgyCoreTests   = "$bgyRoot/tests";

/*
 * Prepend the Zend Framework library/ and tests/ directories to the
 * include_path. This allows the tests to run out of the box and helps prevent
 * loading other copies of the framework code and tests that would supersede
 * this copy.
 */
$path = array(
    $zfCoreLibrary,
    $bgyCoreLibrary,
    $bgyCoreTests,
    get_include_path()
    );
set_include_path(implode(PATH_SEPARATOR, $path));

/*
 * Load the user-defined test configuration file, if it exists; otherwise, load
 * the default configuration.
 */

/**
 * Start output buffering, if enabled
 */
if (defined('TESTS_ZEND_OB_ENABLED') && constant('TESTS_ZEND_OB_ENABLED')) {
    ob_start();
}

/*
 * Unset global variables that are no longer needed.
 */
unset($bgyRoot, $zfCoreLibrary, $bgyCoreLibrary, $bgyCoreTests, $path);

