Skip to content
Snippets Groups Projects
Commit 911801b4 authored by Elmar Ludwig's avatar Elmar Ludwig Committed by Jan-Hendrik Willms
Browse files

fix tests in CI, fixes #42

parent 674713db
No related branches found
No related tags found
No related merge requests found
...@@ -780,6 +780,7 @@ RECURSIVE = YES ...@@ -780,6 +780,7 @@ RECURSIVE = YES
# run. # run.
EXCLUDE = vendor \ EXCLUDE = vendor \
composer \
public/plugins_packages \ public/plugins_packages \
db \ db \
locale \ locale \
......
...@@ -309,7 +309,7 @@ class StudipAutoloader ...@@ -309,7 +309,7 @@ class StudipAutoloader
*/ */
private static function sanitizePath($path) private static function sanitizePath($path)
{ {
if (mb_strpos($path, $GLOBALS['STUDIP_BASE_PATH']) === 0) { if (isset($GLOBALS['STUDIP_BASE_PATH']) && strpos($path, $GLOBALS['STUDIP_BASE_PATH']) === 0) {
return ltrim(str_replace($GLOBALS['STUDIP_BASE_PATH'], '', $path), DIRECTORY_SEPARATOR); return ltrim(str_replace($GLOBALS['STUDIP_BASE_PATH'], '', $path), DIRECTORY_SEPARATOR);
} }
return $path; return $path;
......
...@@ -182,7 +182,7 @@ class StudipCacheFactory ...@@ -182,7 +182,7 @@ class StudipCacheFactory
*/ */
public static function loadCacheClass() public static function loadCacheClass()
{ {
$cacheConfig = Config::get()->SYSTEMCACHE; $cacheConfig = self::getConfig()->SYSTEMCACHE;
$cache_class = $cacheConfig['type'] ?: null; $cache_class = $cacheConfig['type'] ?: null;
...@@ -222,7 +222,7 @@ class StudipCacheFactory ...@@ -222,7 +222,7 @@ class StudipCacheFactory
*/ */
public static function retrieveConstructorArguments() public static function retrieveConstructorArguments()
{ {
$cacheConfig = Config::get()->SYSTEMCACHE; $cacheConfig = self::getConfig()->SYSTEMCACHE;
return $cacheConfig ?: []; return $cacheConfig ?: [];
} }
......
<?php
$result = [
0 =>
[
'name' => 'task_id',
'type' => 'char(32)',
'null' => 'NO',
'key' => 'PRI',
'default' => '',
'extra' => '',
],
1 =>
[
'name' => 'filename',
'type' => 'varchar(255)',
'null' => 'NO',
'key' => '',
'default' => '',
'extra' => '',
],
2 =>
[
'name' => 'class',
'type' => 'varchar(255)',
'null' => 'NO',
'key' => '',
'default' => '',
'extra' => '',
],
3 =>
[
'name' => 'active',
'type' => 'tinyint(1) unsigned',
'null' => 'NO',
'key' => '',
'default' => 0,
'extra' => '',
],
4 =>
[
'name' => 'execution_count',
'type' => 'bigint(20) unsigned',
'null' => 'NO',
'key' => '',
'default' => 0,
'extra' => '',
],
5 =>
[
'name' => 'assigned_count',
'type' => 'int(11) unsigned',
'null' => 'NO',
'key' => '',
'default' => 0,
'extra' => '',
],
6 =>
[
'name' => 'mkdate',
'type' => 'int(11) unsigned',
'null' => 'YES',
'key' => '',
'default' => NULL,
'extra' => '',
],
7 =>
[
'name' => 'chdate',
'type' => 'int(11) unsigned',
'null' => 'YES',
'key' => '',
'default' => NULL,
'extra' => '',
],
];
...@@ -109,7 +109,7 @@ if (!class_exists('StudipTestHelper')) { ...@@ -109,7 +109,7 @@ if (!class_exists('StudipTestHelper')) {
static function set_up_tables($tables) static function set_up_tables($tables)
{ {
// first step, set fake cache // first step, set fake cache
$testconfig = new Config(['cache_class' => 'StudipArrayCache']); $testconfig = new Config(['SYSTEMCACHE' => ['type' => 'StudipArrayCache']]);
Config::set($testconfig); Config::set($testconfig);
StudipCacheFactory::setConfig($testconfig); StudipCacheFactory::setConfig($testconfig);
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
*/ */
require_once 'config.inc.php'; //$SMILE_SHORT and $SYMBOL_SHORT needed by formatReady
require_once 'lib/models/SimpleORMap.class.php'; require_once 'lib/models/SimpleORMap.class.php';
require_once 'lib/models/OpenGraphURL.class.php'; require_once 'lib/models/OpenGraphURL.class.php';
require_once 'lib/visual.inc.php'; require_once 'lib/visual.inc.php';
...@@ -28,6 +27,7 @@ class VisualFunctionsTest extends \Codeception\Test\Unit ...@@ -28,6 +27,7 @@ class VisualFunctionsTest extends \Codeception\Test\Unit
Config::set(new Config($config)); Config::set(new Config($config));
$GLOBALS['SMILEY_NO_DB'] = true; $GLOBALS['SMILEY_NO_DB'] = true;
$GLOBALS['SYMBOL_SHORT'] = [];
} }
public function tearDown() public function tearDown()
......
...@@ -18,7 +18,7 @@ class CronjobScheduleTest extends \Codeception\Test\Unit ...@@ -18,7 +18,7 @@ class CronjobScheduleTest extends \Codeception\Test\Unit
{ {
date_default_timezone_set('Europe/Berlin'); date_default_timezone_set('Europe/Berlin');
StudipTestHelper::set_up_tables(['cronjobs_schedules']); StudipTestHelper::set_up_tables(['cronjobs_schedules', 'cronjobs_tasks']);
} }
function tearDown() function tearDown()
......
...@@ -117,8 +117,8 @@ class CSRFRequestTest extends \Codeception\Test\Unit ...@@ -117,8 +117,8 @@ class CSRFRequestTest extends \Codeception\Test\Unit
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XmlHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XmlHttpRequest';
unset($_POST['security_token']); unset($_POST['security_token']);
$this->expectException(InvalidSecurityTokenException::class);
CSRFProtection::verifyUnsafeRequest(); CSRFProtection::verifyUnsafeRequest();
$this->assertTrue(true);
} }
function testUnsafeXHRWithToken() function testUnsafeXHRWithToken()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment