From 5d0e91c8a664afa5f3a860cfab61a2247f900f95 Mon Sep 17 00:00:00 2001 From: Marc Egger <marc.egger@uzh.ch> Date: Tue, 13 Oct 2020 10:25:26 +0200 Subject: [PATCH] reenable phpunit in makefile --- Makefile | 4 +--- extension/Classes/Core/QuickFormQuery.php | 23 ++++++----------------- extension/Classes/Core/Store/Config.php | 6 +++--- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 3f7e2eab0..ca2caf95f 100644 --- a/Makefile +++ b/Makefile @@ -122,9 +122,7 @@ phpunit: cp -v typo3conf/ext/qfq/Tests/phpunit_qfq.json typo3conf/ext/qfq.json; sed -i "s/#PHPUNIT_PASSWORD#/$(PHPUNIT_MYSQL_PASSWORD)/" typo3conf/ext/qfq.json # run phpunit - - # TEMPORARILY DISABLED ! - # cd typo3conf/ext/qfq/; pwd; vendor/bin/phpunit --configuration phpunit.xml + cd typo3conf/ext/qfq/; pwd; vendor/bin/phpunit --configuration phpunit.xml phpunit_snapshot: snapshot phpunit diff --git a/extension/Classes/Core/QuickFormQuery.php b/extension/Classes/Core/QuickFormQuery.php index 014606ad9..bae3aba9e 100644 --- a/extension/Classes/Core/QuickFormQuery.php +++ b/extension/Classes/Core/QuickFormQuery.php @@ -138,20 +138,10 @@ class QuickFormQuery { // PHPExcel set_include_path(get_include_path() . PATH_SEPARATOR . '../../Resources/Private/Classes/'); - if (!isset($t3data[T3DATA_BODYTEXT])) { - // TODO: ?CR: when does this happen? why no exception thrown? - $t3data[T3DATA_BODYTEXT] = ''; - } - - if (!isset($t3data[T3DATA_UID])) { - // TODO: ?CR: when does this happen? why no exception thrown? - $t3data[T3DATA_UID] = 0; - } - - if (!isset($t3data[T3DATA_HEADER])) { - // TODO: ?CR: when does this happen? why no exception thrown? - $t3data[T3DATA_HEADER] = ''; - } + // set dummy values if QuickFormQuery is not called by Typo3 + $t3data[T3DATA_BODYTEXT] = $t3data[T3DATA_BODYTEXT] ?? ''; + $t3data[T3DATA_UID] = $t3data[T3DATA_UID] ?? 0; + $t3data[T3DATA_HEADER] = $t3data[T3DATA_HEADER] ?? ''; // Read report file, if file keyword exists in bodytext $reportPathFileNameFull = ReportAsFile::parseFileKeyword($t3data[T3DATA_BODYTEXT]); @@ -209,9 +199,8 @@ class QuickFormQuery { $dbIndex = ($dbIndex == '') ? DB_INDEX_DEFAULT : $dbIndex; $this->store->setVar(TOKEN_DB_INDEX, $dbIndex, STORE_TYPO3); - // Create report file if file keyword not found - // TODO: ?CR: uid could be 0. When does this happen? - if (strtolower($this->store->getVar(SYSTEM_REPORT_AS_FILE_AUTO_EXPORT, STORE_SYSTEM)) === 'yes' && $reportPathFileNameFull === null && $t3data[T3DATA_UID] !== 0) { + // Create report file if file keyword not found (and auto export is enabled in qfq settings) + if ($reportPathFileNameFull === null && $t3data[T3DATA_UID] !== 0 && strtolower($this->store->getVar(SYSTEM_REPORT_AS_FILE_AUTO_EXPORT, STORE_SYSTEM)) === 'yes') { $reportPathFileNameFull = ReportAsFile::create_file_from_ttContent($t3data[T3DATA_UID], $this->dbArray[$this->dbIndexData]); } diff --git a/extension/Classes/Core/Store/Config.php b/extension/Classes/Core/Store/Config.php index 79d14545b..8714e54e2 100644 --- a/extension/Classes/Core/Store/Config.php +++ b/extension/Classes/Core/Store/Config.php @@ -62,8 +62,8 @@ class Config { } /** - * Read qfq.json (merge with Typo3-qfq config if exists) - * Deprecated config file typo3conf/config.qfq.php is translated to JSON in PATH:cwdToProject(..) + * Read qfq.json (merge with Typo3-qfq config if exists). + * Note: Deprecated config file typo3conf/config.qfq.php is translated to JSON in PATH:cwdToProject(..) * * @param string $PhpUnitOverloadCwdToConfigFile * @throws \CodeException @@ -92,9 +92,9 @@ class Config { } if ($PhpUnitOverloadCwdToConfigFile === '') { + $configT3qfq = self::readTypo3QfqConfig(); // Settings in qfq.json overwrite T3 settings - $configT3qfq = self::readTypo3QfqConfig(); $config = array_merge($configT3qfq, $config); } -- GitLab