From a8eb7a5092fad987b96f9dac947dc9bf4a2b0eaf Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 13 Mar 2014 13:33:09 +0100 Subject: [PATCH] Allow setting the config dir to use as enviroment variable for phpunit --- lib/base.php | 4 +++- tests/bootstrap.php | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/base.php b/lib/base.php index 86ee534982..2d4a9f9276 100644 --- a/lib/base.php +++ b/lib/base.php @@ -103,7 +103,9 @@ class OC { get_include_path() ); - if(defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) { + if(defined('PHPUNIT_CONFIG_DIR')) { + self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/'; + } elseif(defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) { self::$configDir = OC::$SERVERROOT . '/tests/config/'; } else { self::$configDir = OC::$SERVERROOT . '/config/'; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 581cfcff9f..70de7cd1c4 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -3,9 +3,14 @@ define('PHPUNIT_RUN', 1); -require_once __DIR__.'/../lib/base.php'; +$configDir = getenv('CONFIG_DIR'); +if ($configDir) { + define('PHPUNIT_CONFIG_DIR', $configDir); +} -if(!class_exists('PHPUnit_Framework_TestCase')) { +require_once __DIR__ . '/../lib/base.php'; + +if (!class_exists('PHPUnit_Framework_TestCase')) { require_once('PHPUnit/Autoload.php'); }