aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/_bootstrap.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/_bootstrap.php')
-rw-r--r--tests/unit/_bootstrap.php72
1 files changed, 27 insertions, 45 deletions
diff --git a/tests/unit/_bootstrap.php b/tests/unit/_bootstrap.php
index 2216111..0cf0f7e 100644
--- a/tests/unit/_bootstrap.php
+++ b/tests/unit/_bootstrap.php
@@ -21,10 +21,7 @@
// SOFTWARE.
// set error reporting
-error_reporting(E_ALL & ~E_NOTICE);
-if (version_compare(phpversion(), '5.4', '>=')) {
- error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
-}
+error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
// set include path
$inc_path = ini_get('include_path');
@@ -32,47 +29,32 @@ $inc_path .= PATH_SEPARATOR . __DIR__ . '/../..';
$inc_path .= PATH_SEPARATOR . __DIR__ . '/../../config';
ini_set('include_path', $inc_path);
+global $ABSOLUTE_URI_STUDIP,
+ $ASSETS_URL,
+ $CACHING_ENABLE,
+ $CACHING_FILECACHE_PATH,
+ $CANONICAL_RELATIVE_PATH_STUDIP,
+ $DYNAMIC_CONTENT_PATH,
+ $DYNAMIC_CONTENT_URL,
+ $STUDIP_BASE_PATH,
+ $SYMBOL_SHORT,
+ $TMP_PATH,
+ $UPLOAD_PATH;
+
// load varstream for easier filesystem testing
require_once 'varstream.php';
-define("TEST_FIXTURES_PATH", dirname(__DIR__) . "/_data/");
+define('TEST_FIXTURES_PATH', dirname(__DIR__) . '/_data/');
require __DIR__ . '/../../composer/autoload.php';
global $STUDIP_BASE_PATH;
$STUDIP_BASE_PATH = realpath(dirname(__DIR__) . '/..');
-require 'lib/classes/StudipAutoloader.php';
+require 'lib/helpers.php';
require 'lib/functions.php';
require 'lib/visual.inc.php';
-StudipAutoloader::setBasePath(realpath(__DIR__ . '/../..'));
-StudipAutoloader::register();
-
-StudipAutoloader::addAutoloadPath('lib/activities', 'Studip\\Activity');
-StudipAutoloader::addAutoloadPath('lib/models');
-StudipAutoloader::addAutoloadPath('lib/classes');
-StudipAutoloader::addAutoloadPath('lib/classes', 'Studip');
-StudipAutoloader::addAutoloadPath('lib/exceptions');
-StudipAutoloader::addAutoloadPath('lib/classes/sidebar');
-StudipAutoloader::addAutoloadPath('lib/classes/helpbar');
-StudipAutoloader::addAutoloadPath('lib/plugins/engine');
-StudipAutoloader::addAutoloadPath('lib/plugins/core');
-StudipAutoloader::addAutoloadPath('lib/plugins/db');
-
-StudipAutoloader::addClassLookup('StudipController', 'app/controllers/studip_controller.php');
-$trails_classes = [
- 'Trails_Dispatcher', 'Trails_Response', 'Trails_Controller',
- 'Trails_Inflector', 'Trails_Flash',
- 'Trails_Exception', 'Trails_DoubleRenderError', 'Trails_MissingFile',
- 'Trails_RoutingError', 'Trails_UnknownAction', 'Trails_UnknownController',
- 'Trails_SessionRequiredException',
-];
-StudipAutoloader::addClassLookup(
- $trails_classes,
- 'vendor/trails/trails.php'
-);
-
// load config-variables
$added_configs = [];
StudipFileloader::load(
@@ -86,16 +68,16 @@ foreach ($added_configs as $key => $value) {
$GLOBALS[$key] = $value;
}
-$config = Symfony\Component\Yaml\Yaml::parseFile(__DIR__ .'/../unit.suite.yml');
+$config = Symfony\Component\Yaml\Yaml::parseFile(__DIR__ . '/../unit.suite.yml');
// connect to database if configured
if (isset($config['modules']['config']['Db'])) {
- DBManager::getInstance()->setConnection('studip',
+ DBManager::getInstance()->setConnection(
+ 'studip',
$config['modules']['config']['Db']['dsn'],
$config['modules']['config']['Db']['user'],
- $config['modules']['config']['Db']['password']);
-} else {
- //DBManager::getInstance()->setConnection('studip', 'sqlite://'. $GLOBALS ,'', '');
+ $config['modules']['config']['Db']['password']
+ );
}
// Disable caching to fallback to memory cache
@@ -108,7 +90,7 @@ if (!class_exists('StudipTestHelper')) {
static function set_up_tables($tables)
{
// first step, set fake cache
- $cache = StudipCacheFactory::getCache(false);
+ $cache = \Studip\Cache\Factory::getCache(false);
// second step, expire table scheme
SimpleORMap::expireTableScheme();
@@ -116,17 +98,17 @@ if (!class_exists('StudipTestHelper')) {
$schemes = [];
foreach ($tables as $db_table) {
- include TEST_FIXTURES_PATH."simpleormap/$db_table.php";
+ include TEST_FIXTURES_PATH . "simpleormap/$db_table.php";
$db_fields = $pk = [];
foreach ($result as $rs) {
$db_fields[mb_strtolower($rs['name'])] = [
- 'name' => $rs['name'],
- 'null' => $rs['null'],
+ 'name' => $rs['name'],
+ 'null' => $rs['null'],
'default' => $rs['default'],
- 'type' => $rs['type'],
- 'extra' => $rs['extra']
+ 'type' => $rs['type'],
+ 'extra' => $rs['extra'],
];
- if ($rs['key'] == 'PRI'){
+ if ($rs['key'] == 'PRI') {
$pk[] = mb_strtolower($rs['name']);
}
}