aboutsummaryrefslogtreecommitdiff
path: root/src/SemanticScuttle
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-04-06 08:42:26 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-04-06 08:42:26 +0200
commitc81566f5d8c6149e87432b158331fd724e7e35e5 (patch)
treebf3556fd268f419410aeaef1c61af7a5b13834fb /src/SemanticScuttle
parent1a2b37cc3421ba24931c1ef5edb0f06e61db6d5c (diff)
downloadsemanticscuttle-c81566f5d8c6149e87432b158331fd724e7e35e5.tar.gz
semanticscuttle-c81566f5d8c6149e87432b158331fd724e7e35e5.tar.bz2
cherry-pick:
add new feature: allow unit test mode enabling via HTTP GET parameter
Diffstat (limited to 'src/SemanticScuttle')
-rw-r--r--src/SemanticScuttle/header.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/SemanticScuttle/header.php b/src/SemanticScuttle/header.php
index d1a5c29..5d1ec80 100644
--- a/src/SemanticScuttle/header.php
+++ b/src/SemanticScuttle/header.php
@@ -39,6 +39,20 @@ set_include_path(
require_once $datadir . '/config.default.php';
require_once $datadir . '/config.php';
+if (isset($_GET['unittestMode']) && $_GET['unittestMode'] == 1
+) {
+ if ($allowUnittestMode !== true) {
+ header('HTTP/1.0 400 Bad Request');
+ 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')) {
//make local config vars global - needed for unit tests
//run with phpunit
@@ -117,7 +131,7 @@ $tplVars['currentUser'] = $currentUser;
$tplVars['userservice'] = $userservice;
// 6 // Force UTF-8 behaviour for server (cannot be moved into top.inc.php which is not included into every file)
-if (!defined('UNIT_TEST_MODE')) {
+if (!defined('UNIT_TEST_MODE') || defined('HTTP_UNIT_TEST_MODE')) {
//API files define that, so we need a way to support both of them
if (!isset($httpContentType)) {
$httpContentType = 'text/html';