Skip to content
Snippets Groups Projects
Commit da4db433 authored by Christian Kuhn's avatar Christian Kuhn Committed by Benni Mack
Browse files

[BUGFIX] Notice free InlineStackProcessor testing

Change-Id: I77a4782f250a4b37051eb321fd5c6670b4366e24
Resolves: #83908
Releases: master
Reviewed-on: https://review.typo3.org/55726


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarJan Stockfisch <jan.stockfisch@googlemail.com>
Tested-by: default avatarJan Stockfisch <jan.stockfisch@googlemail.com>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarBenni Mack <benni@typo3.org>
parent a77b2e09
Branches
Tags
No related merge requests found
...@@ -72,12 +72,12 @@ class InlineStackProcessor ...@@ -72,12 +72,12 @@ class InlineStackProcessor
if ($i > 0 && $i % 3 == 0) { if ($i > 0 && $i % 3 == 0) {
// Load the TCA configuration of the table field and store it in the stack // Load the TCA configuration of the table field and store it in the stack
// @todo: This TCA loading here must fall - config sub-array shouldn't exist at all! // @todo: This TCA loading here must fall - config sub-array shouldn't exist at all!
$unstable['config'] = $GLOBALS['TCA'][$unstable['table']]['columns'][$unstable['field']]['config']; $unstable['config'] = $GLOBALS['TCA'][$unstable['table']]['columns'][$unstable['field']]['config'] ?? [];
// Fetch TSconfig: // Fetch TSconfig:
// @todo: aaargs ;) // @todo: aaargs ;)
$TSconfig = FormEngineUtility::getTSconfigForTableRow($unstable['table'], ['uid' => $unstable['uid'], 'pid' => $inlineFirstPid], $unstable['field']); $TSconfig = FormEngineUtility::getTSconfigForTableRow($unstable['table'], ['uid' => $unstable['uid'], 'pid' => $inlineFirstPid], $unstable['field']);
// Override TCA field config by TSconfig: // Override TCA field config by TSconfig:
if (!$TSconfig['disabled']) { if (!isset($TSconfig['disabled']) || !$TSconfig['disabled']) {
$unstable['config'] = FormEngineUtility::overrideFieldConf($unstable['config'], $TSconfig); $unstable['config'] = FormEngineUtility::overrideFieldConf($unstable['config'], $TSconfig);
} }
......
...@@ -67,8 +67,8 @@ class FormEngineUtility ...@@ -67,8 +67,8 @@ class FormEngineUtility
{ {
if (is_array($TSconfig)) { if (is_array($TSconfig)) {
$TSconfig = GeneralUtility::removeDotsFromTS($TSconfig); $TSconfig = GeneralUtility::removeDotsFromTS($TSconfig);
$type = $fieldConfig['type']; $type = $fieldConfig['type'] ?? '';
if (is_array($TSconfig['config']) && is_array(static::$allowOverrideMatrix[$type])) { if (isset($TSconfig['config']) && is_array($TSconfig['config']) && is_array(static::$allowOverrideMatrix[$type])) {
// Check if the keys in TSconfig['config'] are allowed to override TCA field config: // Check if the keys in TSconfig['config'] are allowed to override TCA field config:
foreach ($TSconfig['config'] as $key => $_) { foreach ($TSconfig['config'] as $key => $_) {
if (!in_array($key, static::$allowOverrideMatrix[$type], true)) { if (!in_array($key, static::$allowOverrideMatrix[$type], true)) {
...@@ -104,7 +104,7 @@ class FormEngineUtility ...@@ -104,7 +104,7 @@ class FormEngineUtility
if (!isset($cache[$cacheIdentifier])) { if (!isset($cache[$cacheIdentifier])) {
$cache[$cacheIdentifier] = BackendUtility::getTCEFORM_TSconfig($table, $row); $cache[$cacheIdentifier] = BackendUtility::getTCEFORM_TSconfig($table, $row);
} }
if ($field) { if ($field && isset($cache[$cacheIdentifier][$field])) {
return $cache[$cacheIdentifier][$field]; return $cache[$cacheIdentifier][$field];
} }
return $cache[$cacheIdentifier]; return $cache[$cacheIdentifier];
......
<?php <?php
declare(strict_types = 1);
namespace TYPO3\CMS\Backend\Tests\Unit\Form; namespace TYPO3\CMS\Backend\Tests\Unit\Form;
/* /*
...@@ -15,17 +16,13 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form; ...@@ -15,17 +16,13 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form;
*/ */
use TYPO3\CMS\Backend\Form\InlineStackProcessor; use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/** /**
* Test case * Test case
*/ */
class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase class InlineStackProcessorTest extends UnitTestCase
{ {
/**
* Subject is not notice free, disable E_NOTICES
*/
protected static $suppressNotices = true;
/** /**
* @return array * @return array
*/ */
...@@ -39,7 +36,10 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -39,7 +36,10 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'table' => 'childTable', 'table' => 'childTable',
], ],
], ],
[] [
'form' => '',
'object' => '',
]
], ],
'simple 1-level table-uid structure' => [ 'simple 1-level table-uid structure' => [
'data-pageId-childTable-childUid', 'data-pageId-childTable-childUid',
...@@ -49,7 +49,10 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -49,7 +49,10 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'uid' => 'childUid', 'uid' => 'childUid',
], ],
], ],
[] [
'form' => '',
'object' => '',
]
], ],
'simple 1-level table-uid-field structure' => [ 'simple 1-level table-uid-field structure' => [
'data-pageId-childTable-childUid-childField', 'data-pageId-childTable-childUid-childField',
...@@ -60,7 +63,10 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -60,7 +63,10 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'field' => 'childField', 'field' => 'childField',
], ],
], ],
[], [
'form' => '',
'object' => '',
],
], ],
'simple 2-level table structure' => [ 'simple 2-level table structure' => [
'data-pageId-parentTable-parentUid-parentField-childTable', 'data-pageId-parentTable-parentUid-parentField-childTable',
...@@ -70,7 +76,7 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -70,7 +76,7 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'table' => 'parentTable', 'table' => 'parentTable',
'uid' => 'parentUid', 'uid' => 'parentUid',
'field' => 'parentField', 'field' => 'parentField',
'config' => null, 'config' => [],
], ],
], ],
'unstable' => [ 'unstable' => [
...@@ -90,7 +96,7 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -90,7 +96,7 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'table' => 'parentTable', 'table' => 'parentTable',
'uid' => 'parentUid', 'uid' => 'parentUid',
'field' => 'parentField', 'field' => 'parentField',
'config' => null, 'config' => [],
], ],
], ],
'unstable' => [ 'unstable' => [
...@@ -111,7 +117,7 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -111,7 +117,7 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'table' => 'parentTable', 'table' => 'parentTable',
'uid' => 'parentUid', 'uid' => 'parentUid',
'field' => 'parentField', 'field' => 'parentField',
'config' => null, 'config' => [],
], ],
], ],
'unstable' => [ 'unstable' => [
...@@ -133,13 +139,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -133,13 +139,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'table' => 'grandParentTable', 'table' => 'grandParentTable',
'uid' => 'grandParentUid', 'uid' => 'grandParentUid',
'field' => 'grandParentField', 'field' => 'grandParentField',
'config' => null, 'config' => [],
], ],
[ [
'table' => 'parentTable', 'table' => 'parentTable',
'uid' => 'parentUid', 'uid' => 'parentUid',
'field' => 'parentField', 'field' => 'parentField',
'config' => null, 'config' => [],
], ],
], ],
'unstable' => [ 'unstable' => [
...@@ -159,13 +165,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -159,13 +165,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'table' => 'grandParentTable', 'table' => 'grandParentTable',
'uid' => 'grandParentUid', 'uid' => 'grandParentUid',
'field' => 'grandParentField', 'field' => 'grandParentField',
'config' => null, 'config' => [],
], ],
[ [
'table' => 'parentTable', 'table' => 'parentTable',
'uid' => 'parentUid', 'uid' => 'parentUid',
'field' => 'parentField', 'field' => 'parentField',
'config' => null, 'config' => [],
], ],
], ],
'unstable' => [ 'unstable' => [
...@@ -186,13 +192,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -186,13 +192,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'table' => 'grandParentTable', 'table' => 'grandParentTable',
'uid' => 'grandParentUid', 'uid' => 'grandParentUid',
'field' => 'grandParentField', 'field' => 'grandParentField',
'config' => null, 'config' => [],
], ],
[ [
'table' => 'parentTable', 'table' => 'parentTable',
'uid' => 'parentUid', 'uid' => 'parentUid',
'field' => 'parentField', 'field' => 'parentField',
'config' => null, 'config' => [],
], ],
], ],
'unstable' => [ 'unstable' => [
...@@ -217,13 +223,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes ...@@ -217,13 +223,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
'flexform' => [ 'flexform' => [
'data', 'sDEF', 'lDEF', 'grandParentFlexForm', 'vDEF', 'data', 'sDEF', 'lDEF', 'grandParentFlexForm', 'vDEF',
], ],
'config' => null, 'config' => [],
], ],
[ [
'table' => 'parentTable', 'table' => 'parentTable',
'uid' => 'parentUid', 'uid' => 'parentUid',
'field' => 'parentField', 'field' => 'parentField',
'config' => null, 'config' => [],
], ],
], ],
'unstable' => [ 'unstable' => [
......
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