}
// Determine the base URL as ROOT
-if (!isset($_SERVER['HTTP_HOST'])) {
- //not set in unit tests
- define('ROOT', 'http://localhost/');
-} else if (!isset($GLOBALS['root'])) {
+if (!isset($GLOBALS['root'])) {
$pieces = explode('/', $_SERVER['SCRIPT_NAME']);
$rootTmp = '/';
T_textdomain($domain);
// 4 // Session
-session_start();
+if (!defined('UNIT_TEST_MODE')) {
+ session_start();
+}
// 5 // Create mandatory services and objects
$userservice =SemanticScuttle_Service_Factory::getServiceInstance('User');
$tplVars['userservice'] = $userservice;
// 6 // Force UTF-8 behaviour for server (cannot be move into top.inc.php which is not included into every file)
-header('Content-Type: text/html; charset=utf-8');
+if (!defined('UNIT_TEST_MODE')) {
+ header('Content-Type: text/html; charset=utf-8');
+}
?>
define('PHPUnit_MAIN_METHOD', 'AllTests::main');
}
+require_once 'prepare.php';
require_once 'PHPUnit/Framework/TestSuite.php';
class AllTests extends PHPUnit_Framework_TestSuite
--- /dev/null
+<?php
+/**
+ * Prepare the application for unit testing
+ */
+$_SERVER['HTTP_HOST'] = 'http://localhost/';
+define('UNIT_TEST_MODE', true);
+?>
\ No newline at end of file