/ */ /** * Set error reporting to the level to code must comply. */ error_reporting(E_ALL & ~E_STRICT); /** * Determine the root, library and tests directories of the distribution. */ $appRoot = dirname(dirname(dirname(__FILE__))); $appCore = $appRoot . "/application"; $appLibrary = $appRoot . "/library"; $appTests = $appRoot . "/tests/phpunit"; /** * Prepend the app library and tests directories to the include path * so that tests can be run without manual configuration of the include path. */ $path = array($appCore, $appLibrary, $appTests, get_include_path()); set_include_path(implode(PATH_SEPARATOR, $path)); /** * Enable zend auto loader. */ require_once "P4Cms/Loader.php"; Zend_Loader_Autoloader::getInstance()->pushAutoloader(array('P4Cms_Loader', 'autoload')); /** * If tests are run from other than main test folder, * include config section from main phpunit.xml file. */ $cwd = getcwd(); if ($cwd != $appTests) { $configFile = $appTests . '/phpunit.xml'; if (file_exists($configFile)) { chdir(dirname($configFile)); $config = PHPUnit_Util_Configuration::getInstance($configFile); $config->handlePHPConfiguration(); chdir($cwd); } } /** * Define parameters for operating a test server instance. * Note: For each test, a fresh server/depot is created; previous depots are * recursively deleted. Do not modify these settings unless you know what * you are doing. */ if (!defined('TEST_DATA_PATH')) { define('TEST_DATA_PATH', $appRoot . '/tests/data/' . getmypid()); } if (!defined('TEST_ASSETS_PATH')) { define('TEST_ASSETS_PATH', __DIR__ . '/assets'); } if (!defined('TEST_SITES_PATH')) { define('TEST_SITES_PATH', TEST_ASSETS_PATH . '/sites'); } if (!defined('TEST_SCRIPTS_PATH')) { define('TEST_SCRIPTS_PATH', TEST_ASSETS_PATH . '/scripts'); } /** * Make sure the session storage is defined/setup. */ if (!defined('TEST_SESSION_SAVE_PATH')) { define( 'TEST_SESSION_SAVE_PATH', getenv('P4CMS_TEST_SESSION_SAVE_PATH') ? : TEST_DATA_PATH . '/sessions' ); } ini_set('session.save_path', TEST_SESSION_SAVE_PATH); // HTTP_HOST if (!defined('HTTP_HOST') && getenv('P4CMS_TEST_HTTP_HOST')) { define('HTTP_HOST', getenv('P4CMS_TEST_HTTP_HOST')); } // if HTTP_HOST still not defined, warn the tester. if (!defined('HTTP_HOST')) { echo <<