Commit 3923af69 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Refs #8278: Fixes unit tests

parent 6152f1c0
Pipeline #1831 passed with stage
in 2 minutes and 17 seconds
......@@ -223,6 +223,11 @@ class Config {
$maxLength = $config[SYSTEM_SECURITY_GET_MAX_LENGTH];
if ($maxLength > 0 && $attack === false) {
foreach ($_GET as $key => $value) {
if (!is_string($value)) {
continue;
}
// Check if the variable is something like 'my_name_100' - if the part after the last '_' is numerical, this means a valid, non standard length.
$arr = explode(GET_EXTRA_LENGTH_TOKEN, $key);
......@@ -272,7 +277,9 @@ class Config {
$penalty = (empty($config[SYSTEM_SECURITY_ATTACK_DELAY]) || !is_numeric($config[SYSTEM_SECURITY_ATTACK_DELAY])) ?
SYSTEM_SECURITY_ATTACK_DELAY_DEFAULT : $config[SYSTEM_SECURITY_ATTACK_DELAY];
if (!defined('PHPUNIT_QFQ')) {
sleep($penalty);
}
if ($config[SYSTEM_SECURITY_SHOW_MESSAGE] == 'true' || $config[SYSTEM_SECURITY_SHOW_MESSAGE] == 1) {
......
......@@ -118,16 +118,17 @@ class Session
*/
public static function destroy() {
if (!defined('PHPUNIT_QFQ')) {
if (isset($_COOKIE[SESSION_NAME])) {
unset($_COOKIE[SESSION_NAME]);
setcookie(SESSION_NAME, '', time() - 86400, '/'); // empty value and old timestamp
}
if (!defined('PHPUNIT_QFQ')) {
session_destroy();
}
$_SESSION = array();
$_SESSION = array();
}
/**
......
......@@ -43,7 +43,6 @@ class ConfigTest extends TestCase {
$config = Config::setDefaults(array());
// Check for customized length (below)
$_GET = array();
# 60
$_GET['fake_65'] = '012345678901234567890123456789012345678901234567890123456789';
Config::checkForAttack($config);
......@@ -62,9 +61,6 @@ class ConfigTest extends TestCase {
$config = Config::setDefaults(array());
// Check for customized length (below)
$_GET = array();
// Check for customized length (above)
# 80
$_GET['fake_65'] = '01234567890123456789012345678901234567890123456789012345678901234567890123456789';
......@@ -87,4 +83,13 @@ class ConfigTest extends TestCase {
Config::checkForAttack($config);
}
protected function setUp() {
$_GET = array();
$_POST = array();
}
protected function tearDown() {
$_GET = array();
$_POST = array();
}
}
......@@ -32,6 +32,8 @@ class StoreTest extends TestCase {
*/
public function setUp() {
// Client Variables has to setup before the first instantiation of 'Store'
$_GET[] = array();
$_POST[] = array();
$_GET[CLIENT_RECORD_ID] = '1234';
$_GET['key01'] = '1234';
$_POST['key02'] = '2345';
......@@ -327,6 +329,9 @@ class StoreTest extends TestCase {
*/
public function testConfigIniDefaultValues() {
$_GET[] = array();
$_POST[] = array();
$expect = [
SYSTEM_DB_1_USER => '<DBUSER>',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment