aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-09-27 07:49:10 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2023-09-27 07:49:10 +0000
commit174f11c56e1ce36296e49549da357db7022bf25e (patch)
treee1411291d0e7c32e65cf865c10acbba15ed3b037 /tests
parent81e32c0b8c6f8b6ab94a4cd271e6b308efeb3c5f (diff)
fixes #3207
Closes #3207 Merge request studip/studip!2174
Diffstat (limited to 'tests')
-rw-r--r--tests/_support/_generated/FunctionalTesterActions.php2
-rw-r--r--tests/functional/_bootstrap.php18
-rw-r--r--tests/functional/lib/models/resources/BuildingTest.php2
-rw-r--r--tests/functional/lib/models/resources/LocationTest.php2
-rw-r--r--tests/functional/lib/models/resources/ResourceAssignmentTest.php4
-rw-r--r--tests/functional/lib/models/resources/ResourceTest.php4
-rw-r--r--tests/functional/lib/models/resources/RoomTest.php4
-rw-r--r--tests/functional/lib/resources/ResourceManagerTest.php2
8 files changed, 25 insertions, 13 deletions
diff --git a/tests/_support/_generated/FunctionalTesterActions.php b/tests/_support/_generated/FunctionalTesterActions.php
index b10769a..1f35fae 100644
--- a/tests/_support/_generated/FunctionalTesterActions.php
+++ b/tests/_support/_generated/FunctionalTesterActions.php
@@ -1,4 +1,4 @@
-<?php //[STAMP] 9862bb9e5ebf65fc43909feeee411c2a
+<?php //[STAMP] 80b4e0bf1e286a6a3bd71a25c2b1a786
namespace _generated;
// This class was automatically generated by build task
diff --git a/tests/functional/_bootstrap.php b/tests/functional/_bootstrap.php
index e05f87f..49f3324 100644
--- a/tests/functional/_bootstrap.php
+++ b/tests/functional/_bootstrap.php
@@ -1,9 +1,21 @@
<?php
+global $STUDIP_BASE_PATH, $ABSOLUTE_URI_STUDIP, $CACHING_ENABLE, $CACHING_FILECACHE_PATH, $SYMBOL_SHORT, $TMP_PATH, $UPLOAD_PATH, $ASSETS_URL;
+
+// common set-up, usually done by lib/bootstraph.php and
+// config/config_local.inc.php when run on web server
+if (!isset($STUDIP_BASE_PATH)) {
+ $STUDIP_BASE_PATH = dirname(__DIR__, 2);
+ $ABSOLUTE_PATH_STUDIP = $STUDIP_BASE_PATH.'/public/';
+ $UPLOAD_PATH = $STUDIP_BASE_PATH.'/data/upload_doc';
+ $TMP_PATH = $TMP_PATH ?: '/tmp';
+ $ASSETS_URL = '';
+}
+
// set include path
$inc_path = ini_get('include_path');
-$inc_path .= PATH_SEPARATOR . dirname(__FILE__) . '/../..';
-$inc_path .= PATH_SEPARATOR . dirname(__FILE__) . '/../../config';
+$inc_path .= PATH_SEPARATOR . __DIR__ . '/../..';
+$inc_path .= PATH_SEPARATOR . __DIR__ . '/../../config';
ini_set('include_path', $inc_path);
require 'lib/classes/StudipAutoloader.php';
@@ -37,7 +49,7 @@ $added_configs = [];
StudipFileloader::load(
'config_defaults.inc.php config_local.inc.php',
$added_configs,
- compact('STUDIP_BASE_PATH', 'ABSOLUTE_URI_STUDIP', 'ASSETS_URL', 'CANONICAL_RELATIVE_PATH_STUDIP'),
+ compact('STUDIP_BASE_PATH', 'ABSOLUTE_URI_STUDIP', 'ASSETS_URL'),
true
);
foreach($added_configs as $key => $value) {
diff --git a/tests/functional/lib/models/resources/BuildingTest.php b/tests/functional/lib/models/resources/BuildingTest.php
index 6576196..17c58a4 100644
--- a/tests/functional/lib/models/resources/BuildingTest.php
+++ b/tests/functional/lib/models/resources/BuildingTest.php
@@ -49,7 +49,7 @@ class BuildingTest extends \Codeception\Test\Unit
\DBManager::getInstance()->setConnection('studip', $this->db_handle);
// Workaround old-style Stud.IP-API using $GLOBALS['user']
- $this->oldUser = $GLOBALS['user'];
+ $this->oldUser = $GLOBALS['user'] ?? null;
$GLOBALS['user'] = new \Seminar_User(
\User::findByUsername('root@studip')
);
diff --git a/tests/functional/lib/models/resources/LocationTest.php b/tests/functional/lib/models/resources/LocationTest.php
index a8c4261..f283cab 100644
--- a/tests/functional/lib/models/resources/LocationTest.php
+++ b/tests/functional/lib/models/resources/LocationTest.php
@@ -50,7 +50,7 @@ class LocationTest extends \Codeception\Test\Unit
\DBManager::getInstance()->setConnection('studip', $this->db_handle);
// Workaround old-style Stud.IP-API using $GLOBALS['user']
- $this->oldUser = $GLOBALS['user'];
+ $this->oldUser = $GLOBALS['user'] ?? null;
$GLOBALS['user'] = new \Seminar_User(
\User::findByUsername('root@studip')
);
diff --git a/tests/functional/lib/models/resources/ResourceAssignmentTest.php b/tests/functional/lib/models/resources/ResourceAssignmentTest.php
index f2c2fcd..87fbde7 100644
--- a/tests/functional/lib/models/resources/ResourceAssignmentTest.php
+++ b/tests/functional/lib/models/resources/ResourceAssignmentTest.php
@@ -52,11 +52,11 @@ class ResourceAssignmentTest extends \Codeception\Test\Unit
\Config::get()->setValue('LOG_ENABLE', false);
// Workaround old-style Stud.IP-API using $GLOBALS['user']
- $this->oldUser = $GLOBALS['user'];
+ $this->oldUser = $GLOBALS['user'] ?? null;
$GLOBALS['user'] = new \Seminar_User(
\User::findByUsername('root@studip')
);
- $this->oldPerm = $GLOBALS['perm'];
+ $this->oldPerm = $GLOBALS['perm'] ?? null;
$GLOBALS['perm'] = new \Seminar_Perm();
//As a final step we create the SORM objects for our test cases:
diff --git a/tests/functional/lib/models/resources/ResourceTest.php b/tests/functional/lib/models/resources/ResourceTest.php
index 75a082a..96003d7 100644
--- a/tests/functional/lib/models/resources/ResourceTest.php
+++ b/tests/functional/lib/models/resources/ResourceTest.php
@@ -46,11 +46,11 @@ class ResourceTest extends \Codeception\Test\Unit
\DBManager::getInstance()->setConnection('studip', $this->db_handle);
// Workaround old-style Stud.IP-API using $GLOBALS['user']
- $this->oldUser = $GLOBALS['user'];
+ $this->oldUser = $GLOBALS['user'] ?? null;
$GLOBALS['user'] = new \Seminar_User(
\User::findByUsername('root@studip')
);
- $this->oldPerm = $GLOBALS['perm'];
+ $this->oldPerm = $GLOBALS['perm'] ?? null;
$GLOBALS['perm'] = new \Seminar_Perm();
//As a final step we create the SORM objects for our test cases:
diff --git a/tests/functional/lib/models/resources/RoomTest.php b/tests/functional/lib/models/resources/RoomTest.php
index 82611f2..8dd30a4 100644
--- a/tests/functional/lib/models/resources/RoomTest.php
+++ b/tests/functional/lib/models/resources/RoomTest.php
@@ -61,11 +61,11 @@ class RoomTest extends \Codeception\Test\Unit
\DBManager::getInstance()->setConnection('studip', $this->db_handle);
// Workaround old-style Stud.IP-API using $GLOBALS['user']
- $this->oldUser = $GLOBALS['user'];
+ $this->oldUser = $GLOBALS['user'] ?? null;
$GLOBALS['user'] = new \Seminar_User(
\User::findByUsername('root@studip')
);
- $this->oldPerm = $GLOBALS['perm'];
+ $this->oldPerm = $GLOBALS['perm'] ?? null;
$GLOBALS['perm'] = new \Seminar_Perm();
//As a final step we create the SORM objects for our test cases:
diff --git a/tests/functional/lib/resources/ResourceManagerTest.php b/tests/functional/lib/resources/ResourceManagerTest.php
index f858e90..49e585a 100644
--- a/tests/functional/lib/resources/ResourceManagerTest.php
+++ b/tests/functional/lib/resources/ResourceManagerTest.php
@@ -31,7 +31,7 @@ class ResourceManagerTest extends \Codeception\Test\Unit
\DBManager::getInstance()->setConnection('studip', $this->db_handle);
// Workaround old-style Stud.IP-API using $GLOBALS['user']
- $this->oldUser = $GLOBALS['user'];
+ $this->oldUser = $GLOBALS['user'] ?? null;
$GLOBALS['user'] = new \Seminar_User(
\User::findByUsername('root@studip')
);