diff --git a/lib/classes/SemType.class.php b/lib/classes/SemType.class.php index 88244065edf6ded03812509b4aea8ebbf733f3f1..3d5de5d94fdb66681bc7fe49117465890eaf39ee 100644 --- a/lib/classes/SemType.class.php +++ b/lib/classes/SemType.class.php @@ -108,7 +108,7 @@ class SemType implements ArrayAccess } public function getClass() { - return $GLOBALS['SEM_CLASS'][$this->data['class']] ?: SemClass::getDefaultSemClass(); + return $GLOBALS['SEM_CLASS'][$this->data['class']] ?? SemClass::getDefaultSemClass(); } /*************************************************************************** diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php index 6a5903e1411ec730a4ed72857fa8c9c79199a88e..b27e2ce5f3776185b2bc6e74150539af6ff478a5 100644 --- a/lib/classes/Seminar.class.php +++ b/lib/classes/Seminar.class.php @@ -307,9 +307,9 @@ class Seminar $cache_key = 'course/undecorated_data/'. $this->id; if ($filter) { - $sub_key = $_SESSION['_language'] .'/'. $this->filterStart .'-'. $this->filterEnd; + $sub_key = ($_SESSION['_language'] ?? 'none') .'/'. $this->filterStart .'-'. $this->filterEnd; } else { - $sub_key = $_SESSION['_language'] .'/unfiltered'; + $sub_key = ($_SESSION['_language'] ?? 'none') .'/unfiltered'; } $data = unserialize($cache->read($cache_key)); diff --git a/lib/language.inc.php b/lib/language.inc.php index 414f80aa00c0e2b22283c4c20392183aee8d532c..acf133b3251fcc357ccec1c86166d2cd67ec61b9 100644 --- a/lib/language.inc.php +++ b/lib/language.inc.php @@ -194,7 +194,7 @@ function setTempLanguage ($uid = FALSE, $temp_language = "") { */ function restoreLanguage() { global $_language_domain; - setLocaleEnv($_SESSION['_language'] ?: Config::get()->DEFAULT_LANGUAGE, $_language_domain); + setLocaleEnv($_SESSION['_language'] ?? Config::get()->DEFAULT_LANGUAGE, $_language_domain); } /** diff --git a/lib/models/Course.class.php b/lib/models/Course.class.php index 4c471ea64e47dc212d2794872417d8898a4f4409..900537332018e8d74edd5e69d5c0e5d9d2816d6b 100644 --- a/lib/models/Course.class.php +++ b/lib/models/Course.class.php @@ -880,7 +880,7 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe $this->setEndSemester($this->duration_time == -1 ? null : Semester::findByTimestamp($this->start_time + $this->duration_time)); } if ($this->isOpenEnded()) { - $this->start_time = $this->start_time ?: Semester::findCurrent()->beginn; + $this->start_time = $this->start_time ?: Semester::findCurrent()->beginn ?? time(); $this->duration_time = -1; } else { $this->start_time = $this->getStartSemester()->beginn; diff --git a/locale/de/LC_MAILS/new_resource_request.php b/locale/de/LC_MAILS/new_resource_request.php index bca3442129877c14b977d8912e99814f5ddfbc25..eecac3556bbf6140458b8ff3e7d0f818a87da8b3 100644 --- a/locale/de/LC_MAILS/new_resource_request.php +++ b/locale/de/LC_MAILS/new_resource_request.php @@ -2,9 +2,9 @@ in der Raumverwaltung erstellt. -<? if ($requested_room): ?> +<? if (!empty($requested_room)): ?> Angefragter Raum: <?= $requested_room ?> -<? elseif ($requested_resource): ?> +<? elseif (!empty($requested_resource)): ?> Angefragte Ressource: <?= $requested_resource ?> <? endif ?> diff --git a/tests/_support/_generated/FunctionalTesterActions.php b/tests/_support/_generated/FunctionalTesterActions.php index b10769a2af897c01fafd70bd9992d016cda82abd..1f35faee49fd9eb2902612a4ae4b053380fecae7 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 e05f87fed79179d89fa6678881442ef392d84113..49f332495c8e160e62cd58f0f031d07fdaecd3b1 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 6576196017415bade6f1156f1f94072a125c60b3..17c58a40411d6bb50454a7298a0050b3c99551b6 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 a8c4261e66aeeac17c611d70987c2e9160cb12c3..f283cabd5f640bb7555326f0b076493a3b90f4c6 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 f2c2fcd9c8325ee3f38ef6e6d156baa9ea00824a..87fbde74bfeb55ca1b5faeabaa3d66a133283db3 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 75a082a0fb6bc0fbd5dac23b9067e1dd637df5d7..96003d7d9ffb743144c9c0bfd7b9f74cfa2b63b2 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 82611f20038bea03b965bc8d9f6c96a8a28b7947..8dd30a499b4712828b2e1068ebef5a62ee81f7ca 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 f858e9009725bda13fe4ec64a8ce38aae8ea154e..49e585adb84fdc4e6a05a461270b608d86ea37ad 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') );