diff options
author | Christian Weiske <cweiske@cweiske.de> | 2011-05-19 07:38:35 +0200 |
---|---|---|
committer | Christian Weiske <cweiske@cweiske.de> | 2011-05-19 07:38:35 +0200 |
commit | ef23f01ebab448f10cb3935af4a2723f0e362c38 (patch) | |
tree | 9d16e757b3e30daa38a0bed1eb276a8bb26b3ac6 /src | |
parent | e118a7d97b964a3146c35139da92d6514eb3b235 (diff) | |
download | semanticscuttle-ef23f01ebab448f10cb3935af4a2723f0e362c38.tar.gz semanticscuttle-ef23f01ebab448f10cb3935af4a2723f0e362c38.tar.bz2 |
begin supporting a different database for unit tests
Diffstat (limited to 'src')
-rw-r--r-- | src/SemanticScuttle/header-standalone.php | 2 | ||||
-rw-r--r-- | src/SemanticScuttle/header.php | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/SemanticScuttle/header-standalone.php b/src/SemanticScuttle/header-standalone.php index cc1b0bd..50732a6 100644 --- a/src/SemanticScuttle/header-standalone.php +++ b/src/SemanticScuttle/header-standalone.php @@ -14,7 +14,7 @@ * @link http://sourceforge.net/projects/semanticscuttle */ $_SERVER['HTTP_HOST'] = 'http://localhost/'; -define('UNIT_TEST_MODE', true); +//define('UNIT_TEST_MODE', true); require_once dirname(__FILE__) . '/header.php'; ?>
\ No newline at end of file diff --git a/src/SemanticScuttle/header.php b/src/SemanticScuttle/header.php index b0705b0..098e5c3 100644 --- a/src/SemanticScuttle/header.php +++ b/src/SemanticScuttle/header.php @@ -46,14 +46,21 @@ if (isset($_GET['unittestMode']) && $_GET['unittestMode'] == 1 die("Unittestmode is not allowed\n"); } - $unittestConfigFile = $datadir . '/config.unittest.php'; - if (file_exists($unittestConfigFile)) { - require_once $unittestConfigFile; - } define('HTTP_UNIT_TEST_MODE', true); define('UNIT_TEST_MODE', true); } if (defined('UNIT_TEST_MODE')) { + //load configuration for unit tests + $testingConfigFile = $datadir . '/config.testing.php'; + if (file_exists($testingConfigFile)) { + require_once $testingConfigFile; + } + //test-specific configuration file + $unittestConfigFile = $datadir . '/config.testing-tmp.php'; + if (file_exists($unittestConfigFile)) { + require_once $unittestConfigFile; + } + //make local config vars global - needed for unit tests //run with phpunit foreach (get_defined_vars() as $var => $value) { @@ -107,7 +114,7 @@ T_bind_textdomain_codeset($domain, 'UTF-8'); T_textdomain($domain); // 4 // Session -if (!defined('UNIT_TEST_MODE') || defined('HTTP_UNIT_TEST_MODE')) { +if (isset($_SERVER['REMOTE_ADDR'])) { session_start(); if ($GLOBALS['enableVoting']) { if (isset($_SESSION['lastUrl'])) { |