summaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-01-17 14:40:48 +0100
committerRobin Appelman <icewind@owncloud.com>2014-01-17 14:40:48 +0100
commit6b4c3df0876a4786bbde406349746600c87e1e6b (patch)
tree2c1b02a38d7b2648d9d30e7d6aa66fbcc6b01574 /lib/base.php
parent16033c81235e76af2900fdc8fd9340546301d45c (diff)
downloadnextcloud-server-6b4c3df0876a4786bbde406349746600c87e1e6b.tar.gz
nextcloud-server-6b4c3df0876a4786bbde406349746600c87e1e6b.zip
Load a separate config (if present) when running unit tests
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php
index f30575c7b12..d320f6f2411 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -57,6 +57,9 @@ class OC {
* web path in 'url'
*/
public static $APPSROOTS = array();
+
+ public static $configDir;
+
/*
* requested app
*/
@@ -100,6 +103,13 @@ class OC {
get_include_path()
);
+ if(defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/test_config/')) {
+ self::$configDir = OC::$SERVERROOT . '/test_config/';
+ } else {
+ self::$configDir = OC::$SERVERROOT . '/config/';
+ }
+ OC_Config::$object = new \OC\Config(self::$configDir);
+
OC::$SUBURI = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(OC::$SERVERROOT)));
$scriptName = OC_Request::scriptName();
if (substr($scriptName, -1) == '/') {
@@ -175,8 +185,8 @@ class OC {
}
public static function checkConfig() {
- if (file_exists(OC::$SERVERROOT . "/config/config.php")
- and !is_writable(OC::$SERVERROOT . "/config/config.php")
+ if (file_exists(self::$configDir . "/config.php")
+ and !is_writable(self::$configDir . "/config.php")
) {
$defaults = new OC_Defaults();
if (self::$CLI) {