Commit 9c2c34b3 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Report.php: remove showDebugInfo.

Sip.php: disabled session_start in phpUnit environment.
Store.php, AbstractDatabaseTest.php: removes phpUnit flag in constructor - class is static and the flag will be set in Store::getInstance().
BodyTextParser.php, QuickFormQueryTest.php, StoreTest.php: removed token debugShowStack, TYPO#_DEBUG_LOAD, TYPO3_DEBUG_SAVE - no longer used.
Constants.php: removed token TYPO3_DEBUG_LOAD, TYPO3_DEBUG_SAVE - no longer used.
parent 07de2dee
......@@ -61,7 +61,7 @@ class BodytextParser {
$full = '';
foreach ($bodytextArray as $row) {
// Valid 'new line' starts indicators: form, <level>, <level.sublevel>, <level>.<keyword>, {, <level> {, }
if ((1 === preg_match('/^\s*(\d*(\.)?)*\s*(head|althead|tail|sql|rbeg|rend|renr|rsep|fbeg|fend|fsep|form|debugShowStack|debugShowBodyText|r) *=/', $row))
if ((1 === preg_match('/^\s*(\d*(\.)?)*\s*(head|althead|tail|sql|rbeg|rend|renr|rsep|fbeg|fend|fsep|form|debugShowBodyText|r) *=/', $row))
|| (1 === preg_match('/^\s*(\d*(\.)?)*\s*({|})\s*/', $row))
|| (1 === preg_match('/^\s*(\d+(\.)?)+/', $row))
) {
......
......@@ -209,8 +209,6 @@ const CLIENT_PHP_SELF = 'PHP_SELF';
// T3 Bodytext Keywords
const TYPO3_FORM = CLIENT_FORM;
const TYPO3_DEBUG_LOAD = 'debugLoad';
const TYPO3_DEBUG_SAVE = 'debugSave';
const TYPO3_FE_USER = 'feUser';
const TYPO3_FE_USER_UID = 'feUserUid';
const TYPO3_FE_USER_GROUP = 'feUserGroup';
......
......@@ -82,6 +82,8 @@ class Report {
private $phpUnit = false;
private $showDebugInfo = false;
/**
* Report constructor.
*
......@@ -95,6 +97,8 @@ class Report {
$this->sip = new Sip($sessionName, $phpUnit);
$this->store = Store::getInstance();
$this->showDebugInfo = ($this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes');
$this->page_control["msgbox"]["pagec"] = "Please confirm!";
$this->page_control["hash"]["paged"] = "h";
......@@ -152,12 +156,6 @@ class Report {
// Report
$content = $this->triggerReport();
if ($this->fr_error["debug_level"] >= DEBUG_EXTREME) {
// debug($this->frArray);
// debug($_SESSION);
}
return $content;
}
......
......@@ -42,7 +42,7 @@ class Sip {
if ($phpUnit) {
$_SESSION = null;
@session_start();
// @session_start();
} else {
// session_name($sessionname);
......
......@@ -72,12 +72,11 @@ class Store {
private static $sanitizeStore = array();
private static $phpUnit = false;
/**
* @param string $bodytext
*/
private function __construct($bodytext = '', $phpUnit = false) {
self::$phpUnit = false;
private function __construct($bodytext = '') {
self::$sanitizeClass = [
// TYPO3_DEBUG_LOAD => SANITIZE_ALLOW_DIGIT,
......@@ -168,7 +167,7 @@ class Store {
throw new qfq\UserFormException ("Error read file " . CONFIG_INI . ": " . $e->getMessage(), ERROR_IO_READ_FILE);
}
if(!isset($config['SHOW_DEBUG_INFO']) || $config['SHOW_DEBUG_INFO'] === 'auto') {
if (!isset($config['SHOW_DEBUG_INFO']) || $config['SHOW_DEBUG_INFO'] === 'auto') {
$config['SHOW_DEBUG_INFO'] = (isset($GLOBALS["TSFE"]->beUserLogin) && $GLOBALS["TSFE"]->beUserLogin === true) ? 'yes' : 'no';
}
......@@ -355,7 +354,9 @@ class Store {
// Design Pattern: Singleton
if (self::$instance === null) {
self::$instance = new self($bodytext, self::$phpUnit);
self::$phpUnit = $phpUnit;
self::$instance = new self($bodytext);
} else {
// Class Store seems to be presistent over multiple QFQ instantiation. Set bodytext again, with every new request (if bodytext is given).
if ($bodytext !== '')
......@@ -365,6 +366,7 @@ class Store {
return self::$instance;
}
/**
* @param $store
*/
......
......@@ -56,7 +56,7 @@ abstract class AbstractDatabaseTest extends PHPUnit_Framework_TestCase {
protected function setUp() {
// Init the store also reads db credential configuration
$this->store = \qfq\Store::getInstance();
$this->store = \qfq\Store::getInstance('', true);
// SWITCH to TestDB
$this->store->setVar(SYSTEM_DB_NAME, $this->store->getVar(SYSTEM_DB_NAME_TEST, STORE_SYSTEM), STORE_SYSTEM);
......
......@@ -18,7 +18,7 @@ class QuickFormQueryTest extends \PHPUnit_Framework_TestCase {
public function testProcess() {
$form = new qfq\QuickFormQuery(['bodytext' => "\n; some comment\n" . TYPO3_FORM . "=testformnameDoNotChange\n" . TYPO3_DEBUG_SAVE . "=6\n" . TYPO3_DEBUG_LOAD . "=7\n"]);
$form = new qfq\QuickFormQuery(['bodytext' => "\n; some comment\n" . TYPO3_FORM . "=testformnameDoNotChange\n"]);
// $this->assertEquals("", $form->process());
}
......
......@@ -37,7 +37,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase {
$_GET['key04'] = '4567';
$_POST['key04'] = '5678';
$this->store = Store::getInstance("\n; some comment\n" . TYPO3_FORM . "=testformnameDoNotChange\n" . TYPO3_DEBUG_SAVE . "=6\n" . TYPO3_DEBUG_LOAD . "=7\n", true);
$this->store = Store::getInstance("\n; some comment\n" . TYPO3_FORM . "=testformnameDoNotChange\n", true);
}
......@@ -55,14 +55,6 @@ class StoreTest extends \PHPUnit_Framework_TestCase {
$this->store->setVar(TYPO3_FORM, "testformnameDoNotChange", STORE_TYPO3);
$this->assertEquals('testformnameDoNotChange', $this->store->getVar(TYPO3_FORM, STORE_TYPO3), "System: " . TYPO3_FORM);
// T3 Bodytext
$this->store->setVar(TYPO3_DEBUG_SAVE, "6", STORE_TYPO3);
$this->assertEquals('6', $this->store->getVar(TYPO3_DEBUG_SAVE, STORE_TYPO3), "System: " . TYPO3_DEBUG_SAVE);
// T3 Bodytext
$this->store->setVar(TYPO3_DEBUG_LOAD, "7", STORE_TYPO3);
$this->assertEquals('7', $this->store->getVar(TYPO3_DEBUG_LOAD, STORE_TYPO3), "System: " . TYPO3_DEBUG_LOAD);
}
public function testGetVarStoreSystem() {
......
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