[BUGFIX] Notice free FormEngine testing 34/55834/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 20 Feb 2018 16:00:20 +0000 (17:00 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 20 Feb 2018 19:58:55 +0000 (20:58 +0100)
Similar solutions as in issue #83975

Change-Id: I04c06f0e73f5e7d44f225ad9b60c9cbed1016308
Resolves: #83981
Related: #83975
Releases: master
Reviewed-on: https://review.typo3.org/55834
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
41 files changed:
typo3/sysext/backend/Classes/Form/Container/AbstractContainer.php
typo3/sysext/backend/Classes/Form/Container/ListOfFieldsContainer.php
typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseRecordTypeValue.php
typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseUserPermissionCheck.php
typo3/sysext/backend/Classes/Form/FormDataProvider/EvaluateDisplayConditions.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaCheckboxItems.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessFieldLabels.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaGroup.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInputPlaceholders.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaRadioItems.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaRecordTitle.php
typo3/sysext/backend/Classes/Form/NodeFactory.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Tests/Unit/Form/Container/ListOfFieldsContainerTest.php
typo3/sysext/backend/Tests/Unit/Form/Container/PaletteAndSingleContainerTest.php
typo3/sysext/backend/Tests/Unit/Form/Element/AbstractFormElementTest.php
typo3/sysext/backend/Tests/Unit/Form/Element/InputDateTimeElementTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseDefaultLanguagePageRowTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseRecordTypeValueTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseRowInitializeNewTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseSystemLanguageRowsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseUserPermissionCheckTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/EvaluateDisplayConditionsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaCheckboxItemsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaColumnsProcessCommonTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaColumnsProcessFieldLabelsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaColumnsProcessRecordTitleTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaColumnsProcessShowitemTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaFlexPrepareTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaFlexProcessTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaGroupTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaInlineConfigurationTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaInlineExpandCollapseStateTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaInlineTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaInputPlaceholdersTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaRadioItemsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaRecordTitleTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectTreeItemsTest.php
typo3/sysext/backend/Tests/Unit/Form/NodeFactoryTest.php
typo3/sysext/core/Classes/Database/RelationHandler.php
typo3/sysext/core/Classes/Tree/TableConfiguration/TreeDataProviderFactory.php

index 4109b50..968c96b 100644 (file)
@@ -94,8 +94,8 @@ abstract class AbstractContainer extends AbstractNode
         }
         return [
             'fieldName' => $fieldArray[0],
-            'fieldLabel' => $fieldArray[1] ?: null,
-            'paletteName' => $fieldArray[2] ?: null,
+            'fieldLabel' => !empty($fieldArray[1]) ? $fieldArray[1] : null,
+            'paletteName' => !empty($fieldArray[2]) ? $fieldArray[2] : null,
         ];
     }
 
index 2c6d1cd..1cc6dd6 100644 (file)
@@ -38,7 +38,7 @@ class ListOfFieldsContainer extends AbstractContainer
         $recordTypeValue = $this->data['recordTypeValue'];
 
         // Load the description content for the table if requested
-        if ($GLOBALS['TCA'][$table]['interface']['always_description']) {
+        if (!empty($GLOBALS['TCA'][$table]['interface']['always_description'])) {
             $languageService = $this->getLanguageService();
             $languageService->loadSingleTableDescription($table);
         }
index 2e2f4c4..eb58a6b 100644 (file)
@@ -86,7 +86,7 @@ class DatabaseRecordTypeValue implements FormDataProviderInterface
                 if (!empty($foreignUid)) {
                     // Determine table name to fetch record from
                     if ($relationType === 'select') {
-                        $foreignTable = $result['processedTca']['columns'][$pointerField]['config']['foreign_table'];
+                        $foreignTable = $result['processedTca']['columns'][$pointerField]['config']['foreign_table'] ?? '';
                     } else {
                         $allowedTables = explode(',', $result['processedTca']['columns'][$pointerField]['config']['allowed']);
                         // Always take the first configured table.
index 8c8f275..c466253 100644 (file)
@@ -125,7 +125,7 @@ class DatabaseUserPermissionCheck implements FormDataProviderInterface
                 }
             } else {
                 // A non page record is edited.
-                if (is_array($result['parentPageRow'])) {
+                if (isset($result['parentPageRow']) && is_array($result['parentPageRow'])) {
                     // If there is a parent page row, check content edit right of user
                     $userPermissionOnPage = $backendUser->calcPerms($result['parentPageRow']);
                     if ((bool)($userPermissionOnPage & Permission::CONTENT_EDIT)) {
index 91367d3..e29e731 100644 (file)
@@ -62,7 +62,7 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
     {
         $flexColumns = [];
         foreach ($result['processedTca']['columns'] as $columnName => $columnConfiguration) {
-            if ($columnConfiguration['config']['type'] === 'flex') {
+            if (isset($columnConfiguration['config']['type']) && $columnConfiguration['config']['type'] === 'flex') {
                 $flexColumns[$columnName] = $columnConfiguration;
             }
             if (!isset($columnConfiguration['displayCond'])) {
@@ -110,7 +110,7 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
                         'context' => 'flexSheet',
                         'sheetNameFieldNames' => $sheetNameFieldNames,
                         'currentSheetName' => $sheetName,
-                        'flexFormRowData' => $result['databaseRow'][$columnName],
+                        'flexFormRowData' => $result['databaseRow'][$columnName] ?? null,
                     ];
                     $parsedDisplayCondition = $this->parseConditionRecursive(
                         $sheetConfiguration['ROOT']['displayCond'],
@@ -131,7 +131,7 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
                                 'currentSheetName' => $sheetName,
                                 'currentFieldName' => $flexElementName,
                                 'flexFormDataStructure' => $result['processedTca']['columns'][$columnName]['config']['ds'],
-                                'flexFormRowData' => $result['databaseRow'][$columnName],
+                                'flexFormRowData' => $result['databaseRow'][$columnName] ?? null,
                             ];
                             $parsedDisplayCondition = $this->parseConditionRecursive(
                                 $flexElementConfiguration['displayCond'],
@@ -471,8 +471,8 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
                         );
                     }
                 }
-                $sheetName = $flexContext['sheetNameFieldNames'][$givenFieldName]['sheetName'];
-                $fieldName = $flexContext['sheetNameFieldNames'][$givenFieldName]['fieldName'];
+                $sheetName = $flexContext['sheetNameFieldNames'][$givenFieldName]['sheetName'] ?? null;
+                $fieldName = $flexContext['sheetNameFieldNames'][$givenFieldName]['fieldName'] ?? null;
                 if (!isset($flexContext['flexFormRowData']['data'][$sheetName]['lDEF'][$fieldName]['vDEF'])) {
                     throw new \RuntimeException(
                         'Flex form displayCond on sheet "' . $flexContext['currentSheetName'] . '" references field "' . $fieldName
@@ -552,7 +552,7 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
                 );
                 if (in_array($givenFieldName, $listOfLocalContainerElementNames, true)) {
                     // Condition references field of same container instance
-                    $containerType = array_shift(array_keys(
+                    $containerType = current(array_keys(
                         $flexContext['flexFormRowData']['data'][$currentSheetName]
                             ['lDEF'][$currentFieldName]
                             ['el'][$currentContainerIdentifier]
@@ -564,7 +564,7 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
                         ['el'][$givenFieldName]['vDEF'];
                 } elseif (in_array($givenFieldName, array_keys($listOfLocalContainerElementNamesWithSheetName, true))) {
                     // Condition references field name of same container instance and has sheet name included
-                    $containerType = array_shift(array_keys(
+                    $containerType = current(array_keys(
                         $flexContext['flexFormRowData']['data'][$currentSheetName]
                         ['lDEF'][$currentFieldName]
                         ['el'][$currentContainerIdentifier]
@@ -584,7 +584,7 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
                     $fieldName = $flexContext['sheetNameFieldNames'][$givenFieldName]['fieldName'];
                     $fieldValue = $flexContext['flexFormRowData']['data'][$sheetName]['lDEF'][$fieldName]['vDEF'];
                 } else {
-                    $containerType = array_shift(array_keys(
+                    $containerType = current(array_keys(
                         $flexContext['flexFormRowData']['data'][$currentSheetName]
                         ['lDEF'][$currentFieldName]
                         ['el'][$currentContainerIdentifier]
@@ -635,7 +635,7 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
         foreach ($listOfFlexFieldNames as $columnName) {
             $columnConfiguration = $result['processedTca']['columns'][$columnName];
             foreach ($columnConfiguration['config']['ds']['sheets'] as $sheetName => $sheetConfiguration) {
-                if (is_array($sheetConfiguration['ROOT']['displayCond'])) {
+                if (isset($sheetConfiguration['ROOT']['displayCond']) && is_array($sheetConfiguration['ROOT']['displayCond'])) {
                     if (!$this->evaluateConditionRecursive($sheetConfiguration['ROOT']['displayCond'])) {
                         unset($result['processedTca']['columns'][$columnName]['config']['ds']['sheets'][$sheetName]);
                     } else {
@@ -651,10 +651,10 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
             $columnConfiguration = $result['processedTca']['columns'][$columnName];
             if (is_array($columnConfiguration['config']['ds']['sheets'])) {
                 foreach ($columnConfiguration['config']['ds']['sheets'] as $sheetName => $sheetConfiguration) {
-                    if (is_array($sheetConfiguration['ROOT']['el'])) {
+                    if (isset($sheetConfiguration['ROOT']['el']) && is_array($sheetConfiguration['ROOT']['el'])) {
                         foreach ($sheetConfiguration['ROOT']['el'] as $flexField => $flexConfiguration) {
                             $conditionResult = true;
-                            if (is_array($flexConfiguration['displayCond'])) {
+                            if (isset($flexConfiguration['displayCond']) && is_array($flexConfiguration['displayCond'])) {
                                 $conditionResult = $this->evaluateConditionRecursive($flexConfiguration['displayCond']);
                                 if (!$conditionResult) {
                                     unset(
@@ -699,7 +699,7 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
             foreach ($sectionElement['children'] as $containerInstanceName => $containerDataStructure) {
                 if (isset($containerDataStructure['el']) && is_array($containerDataStructure['el'])) {
                     foreach ($containerDataStructure['el'] as $containerElementName => $containerElementConfiguration) {
-                        if (is_array($containerElementConfiguration['displayCond'])) {
+                        if (isset($containerElementConfiguration['displayCond']) && is_array($containerElementConfiguration['displayCond'])) {
                             if (!$this->evaluateConditionRecursive($containerElementConfiguration['displayCond'])) {
                                 unset(
                                     $result['processedTca']['columns'][$columnName]['config']['ds']
index 849cfb8..2d86fe0 100644 (file)
@@ -85,15 +85,12 @@ class TcaCheckboxItems extends AbstractItemProvider implements FormDataProviderI
                 $this->getLanguageService()->sL(trim($checkboxEntry[0])),
                 $checkboxEntry[1]
             ];
-            switch ($config['renderType']) {
-                case 'checkboxToggle':
-                    $newItems = $this->sanitizeToggleCheckbox($checkboxEntry, $itemKey, $newItems);
-                    break;
-                case 'checkboxLabeledToggle':
-                    $newItems = $this->sanitizeLabeledToggleCheckbox($checkboxEntry, $itemKey, $newItems);
-                    break;
-                default:
-                    $newItems = $this->sanitizeIconToggleCheckbox($checkboxEntry, $itemKey, $newItems);
+            if (isset($config['renderType']) && $config['renderType'] === 'checkboxToggle') {
+                $newItems = $this->sanitizeToggleCheckbox($checkboxEntry, $itemKey, $newItems);
+            } elseif (isset($config['renderType']) && $config['renderType'] === 'checkboxLabeledToggle') {
+                $newItems = $this->sanitizeLabeledToggleCheckbox($checkboxEntry, $itemKey, $newItems);
+            } else {
+                $newItems = $this->sanitizeIconToggleCheckbox($checkboxEntry, $itemKey, $newItems);
             }
         }
         return $newItems;
index ac4b044..ef7c8ac 100644 (file)
@@ -62,8 +62,8 @@ class TcaColumnsProcessFieldLabels implements FormDataProviderInterface
             $aShowItemFieldArray = GeneralUtility::trimExplode(';', $aShowItemFieldString);
             $aShowItemFieldArray = [
                 'fieldName' => $aShowItemFieldArray[0],
-                'fieldLabel' => $aShowItemFieldArray[1] ?: null,
-                'paletteName' => $aShowItemFieldArray[2] ?: null,
+                'fieldLabel' => !empty($aShowItemFieldArray[1]) ? $aShowItemFieldArray[1] : null,
+                'paletteName' => !empty($aShowItemFieldArray[2]) ? $aShowItemFieldArray[2] : null,
             ];
             if ($aShowItemFieldArray['fieldName'] === '--div--') {
                 // tabs are not of interest here
index 4f9c495..dd0780a 100644 (file)
@@ -49,7 +49,7 @@ class TcaGroup implements FormDataProviderInterface
 
             // Sanitize max items, set to 99999 if not defined
             $result['processedTca']['columns'][$fieldName]['config']['maxitems'] = MathUtility::forceIntegerInRange(
-                $fieldConfig['config']['maxitems'],
+                $fieldConfig['config']['maxitems'] ?? 0,
                 0,
                 99999
             );
index 2e75a5d..287e518 100644 (file)
@@ -90,7 +90,6 @@ class TcaInputPlaceholders implements FormDataProviderInterface
         }
 
         $fieldName = array_shift($fieldNameArray);
-        $fieldConfig = $result['processedTca']['columns'][$fieldName]['config'];
 
         // Skip if a defined field was actually not present in the database row
         // Using array_key_exists here, since NULL values are valid as well.
@@ -100,6 +99,14 @@ class TcaInputPlaceholders implements FormDataProviderInterface
 
         $value = $result['databaseRow'][$fieldName];
 
+        if (!isset($result['processedTca']['columns'][$fieldName]['config'])
+            || !is_array($result['processedTca']['columns'][$fieldName]['config'])
+        ) {
+            return (string)$value;
+        }
+
+        $fieldConfig = $result['processedTca']['columns'][$fieldName]['config'];
+
         switch ($fieldConfig['type']) {
             case 'select':
                 // The FormDataProviders already resolved the select items to an array of uids,
index 2eb3e0d..1f66076 100644 (file)
@@ -39,7 +39,7 @@ class TcaRadioItems extends AbstractItemProvider implements FormDataProviderInte
                 continue;
             }
 
-            if (!is_array($fieldConfig['config']['items'])) {
+            if (!isset($fieldConfig['config']['items']) || !is_array($fieldConfig['config']['items'])) {
                 throw new \UnexpectedValueException(
                     'Radio field ' . $fieldName . ' of TCA table ' . $result['tableName'] . ' must have \'config\' \'items\' definition',
                     1438594829
index 4330e91..4a5c3b8 100644 (file)
@@ -307,6 +307,9 @@ class TcaRecordTitle implements FormDataProviderInterface
         if (!isset($value)) {
             return '';
         }
+        if (!isset($fieldConfig['eval'])) {
+            return $value;
+        }
         $title = $value;
         $dateTimeFormats = QueryHelper::getDateTimeFormats();
         if (GeneralUtility::inList($fieldConfig['eval'], 'date')) {
index 2a87473..46a1759 100644 (file)
@@ -140,7 +140,7 @@ class NodeFactory
     {
         if (empty($data['renderType'])) {
             throw new Exception(
-                'Missing "renderType" in TCA of field "[' . $data['tableName'] . '][' . $data['fieldName'] . ']".',
+                'Missing "renderType" in TCA of field "[' . ($data['tableName'] ?? 'unknown') . '][' . ($data['fieldName'] ?? 'unknown') . ']".',
                 1431452406
             );
         }
index b22d3b7..fbb81ff 100644 (file)
@@ -1734,7 +1734,7 @@ class BackendUtility
     public static function getRecordTitle($table, $row, $prep = false, $forceResult = true)
     {
         $recordTitle = '';
-        if (is_array($GLOBALS['TCA'][$table])) {
+        if (isset($GLOBALS['TCA'][$table]) && is_array($GLOBALS['TCA'][$table])) {
             // If configured, call userFunc
             if (!empty($GLOBALS['TCA'][$table]['ctrl']['label_userFunc'])) {
                 $params['table'] = $table;
@@ -2366,7 +2366,7 @@ class BackendUtility
             'title' => null,
             'moreInfo' => false
         ];
-        if (is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'][$field])) {
+        if (isset($GLOBALS['TCA_DESCR'][$table]['columns'][$field]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'][$field])) {
             $data = $GLOBALS['TCA_DESCR'][$table]['columns'][$field];
             // Add alternative title, if defined
             if ($data['alttitle']) {
index 106ee11..589ef0a 100644 (file)
@@ -27,11 +27,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 class ListOfFieldsContainerTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @test
      */
     public function renderDelegatesShowitemField()
@@ -41,6 +36,7 @@ class ListOfFieldsContainerTest extends UnitTestCase
         $paletteAndSingleContainerProphecy->render(Argument::cetera())->shouldBeCalled()->willReturn('');
 
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => 'aType',
             'processedTca' => [
                 'types' => [
@@ -74,6 +70,7 @@ class ListOfFieldsContainerTest extends UnitTestCase
         $paletteAndSingleContainerProphecy->render(Argument::cetera())->shouldBeCalled()->willReturn('');
 
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => 'aType',
             'processedTca' => [
                 'types' => [
@@ -107,6 +104,7 @@ class ListOfFieldsContainerTest extends UnitTestCase
         $paletteAndSingleContainerProphecy->render(Argument::cetera())->shouldBeCalled()->willReturn('');
 
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => 'aType',
             'processedTca' => [
                 'types' => [
@@ -148,6 +146,7 @@ class ListOfFieldsContainerTest extends UnitTestCase
         $paletteAndSingleContainerProphecy->render(Argument::cetera())->shouldBeCalled()->willReturn('');
 
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => 'aType',
             'processedTca' => [
                 'types' => [
index 4987aa2..6e12158 100644 (file)
@@ -29,11 +29,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 class PaletteAndSingleContainerTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @test
      */
     public function renderUsesPaletteLabelFromFieldArray()
@@ -54,6 +49,7 @@ class PaletteAndSingleContainerTest extends UnitTestCase
 
         $labelReference = 'LLL:EXT:Resources/Private/Language/locallang.xlf:aLabel';
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => 'aType',
             'processedTca' => [
                 'columns' => [
@@ -110,6 +106,7 @@ class PaletteAndSingleContainerTest extends UnitTestCase
 
         $labelReference = 'LLL:EXT:Resources/Private/Language/locallang.xlf:aLabel';
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => 'aType',
             'processedTca' => [
                 'columns' => [
@@ -168,6 +165,7 @@ class PaletteAndSingleContainerTest extends UnitTestCase
         $labelReferenceFieldArray = 'LLL:EXT:Resources/Private/Language/locallang.xlf:aLabel';
         $labelReferencePaletteArray = 'LLL:EXT:Resources/Private/Language/locallang.xlf:aLabel';
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => 'aType',
             'processedTca' => [
                 'columns' => [
index 4d4493d..9ff377d 100644 (file)
@@ -15,18 +15,14 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form;
  */
 
 use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class AbstractFormElementTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class AbstractFormElementTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @return array
      */
     public function formatValueDataProvider()
@@ -284,7 +280,7 @@ class AbstractFormElementTest extends \TYPO3\TestingFramework\Core\Unit\UnitTest
         $subject = $this->getAccessibleMock(AbstractFormElement::class, ['render'], [], '', false);
         $timezoneBackup = date_default_timezone_get();
         date_default_timezone_set('UTC');
-        $result = $subject->_call('formatValue', $config['format'], $itemValue, $config['format.']);
+        $result = $subject->_call('formatValue', $config['format'], $itemValue, $config['format.'] ?? []);
         date_default_timezone_set($timezoneBackup);
 
         $this->assertEquals($expectedResult, $result);
index 92a2628..d654009 100644 (file)
@@ -17,20 +17,17 @@ namespace typo3\sysext\backend\Tests\Unit\Form\Element;
 use Prophecy\Argument;
 use TYPO3\CMS\Backend\Form\AbstractNode;
 use TYPO3\CMS\Backend\Form\Element\InputDateTimeElement;
+use TYPO3\CMS\Backend\Form\NodeExpansion\FieldInformation;
 use TYPO3\CMS\Backend\Form\NodeFactory;
 use TYPO3\CMS\Core\Localization\LanguageService;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class InputDateTimeElementTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class InputDateTimeElementTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var string Selected timezone backup
      */
     protected $timezoneBackup = '';
@@ -92,6 +89,11 @@ class InputDateTimeElementTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
     {
         date_default_timezone_set($serverTimezone);
         $data = [
+            'tableName' => 'table_foo',
+            'fieldName' => 'field_bar',
+            'databaseRow' => [
+                'uid' => 5,
+            ],
             'parameterArray' => [
                 'tableName' => 'table_foo',
                 'fieldName' => 'field_bar',
@@ -103,6 +105,7 @@ class InputDateTimeElementTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                         'default' => '0000-00-00 00:00:00'
                     ]
                 ],
+                'itemFormElName' => 'myItemFormElName',
                 'itemFormElValue' => $input
             ]
         ];
@@ -115,10 +118,13 @@ class InputDateTimeElementTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
         ]);
         $nodeFactoryProphecy = $this->prophesize(NodeFactory::class);
         $nodeFactoryProphecy->create(Argument::cetera())->willReturn($abstractNode->reveal());
+        $fieldInformationProphecy = $this->prophesize(FieldInformation::class);
+        $fieldInformationProphecy->render(Argument::cetera())->willReturn(['html' => '']);
+        $nodeFactoryProphecy->create(Argument::cetera())->willReturn($fieldInformationProphecy->reveal());
         $languageService = $this->prophesize(LanguageService::class);
         $GLOBALS['LANG'] = $languageService->reveal();
         $subject = new InputDateTimeElement($nodeFactoryProphecy->reveal(), $data);
         $result = $subject->render();
-        $this->assertContains('<input type="hidden" name="" value="' . $expectedOutput . '" />', $result['html']);
+        $this->assertContains('<input type="hidden" name="myItemFormElName" value="' . $expectedOutput . '" />', $result['html']);
     }
 }
index bb30e3b..b9aab4e 100644 (file)
@@ -16,18 +16,14 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseDefaultLanguagePageRow;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class DatabaseDefaultLanguagePageRowTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class DatabaseDefaultLanguagePageRowTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var DatabaseDefaultLanguagePageRow|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $subject;
@@ -55,7 +51,7 @@ class DatabaseDefaultLanguagePageRowTest extends \TYPO3\TestingFramework\Core\Un
         ];
         $result = $this->subject->addData($input);
 
-        $this->assertNull($result['defaultLanguagePageRow']);
+        $this->assertArrayNotHasKey('defaultLanguagePageRow', $result);
     }
 
     /**
index a02dc91..07b8c72 100644 (file)
@@ -15,18 +15,14 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRecordTypeValue;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class DatabaseRecordTypeValueTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class DatabaseRecordTypeValueTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var DatabaseRecordTypeValue|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $subject;
@@ -44,6 +40,7 @@ class DatabaseRecordTypeValueTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     public function addDataThrowsExceptionIfTcaTypesAreEmpty()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'types' => [],
             ],
@@ -133,6 +130,7 @@ class DatabaseRecordTypeValueTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     public function addDataThrowsExceptionIfTypePointsToANotExistingField()
     {
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => '',
             'processedTca' => [
                 'ctrl' => [
@@ -237,6 +235,7 @@ class DatabaseRecordTypeValueTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     public function addDataThrowsExceptionIfValueTypesNotExistsAndNoFallbackExists()
     {
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => '',
             'processedTca' => [
                 'ctrl' => [
@@ -293,6 +292,7 @@ class DatabaseRecordTypeValueTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     public function addDataThrowsExceptionForForeignTypeIfPointerConfigurationHasNoTable()
     {
         $input = [
+            'tableName' => 'aTable',
             'recordTypeValue' => '',
             'processedTca' => [
                 'ctrl' => [
index 56f1099..479756b 100644 (file)
@@ -15,28 +15,14 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowInitializeNew;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class DatabaseRowInitializeNewTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var DatabaseRowInitializeNew
-     */
-    protected $subject;
-
-    protected function setUp()
-    {
-        $this->subject = new DatabaseRowInitializeNew();
-    }
-
-    /**
      * @test
      */
     public function addDataReturnSameDataIfCommandIsEdit()
@@ -56,7 +42,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
                 ],
             ],
         ];
-        $this->assertSame($input, $this->subject->addData($input));
+        $this->assertSame($input, (new DatabaseRowInitializeNew)->addData($input));
     }
 
     /**
@@ -65,12 +51,13 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
     public function addDataThrowsExceptionIfDatabaseRowIsNotArray()
     {
         $input = [
+            'tableName' => 'aTable',
             'command' => 'new',
             'databaseRow' => 'not-an-array',
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1444431128);
-        $this->subject->addData($input);
+        (new DatabaseRowInitializeNew)->addData($input);
     }
 
     /**
@@ -82,13 +69,16 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [
                 'aField' => 42,
             ],
         ];
         $expected = $input;
         $expected['databaseRow']['pid'] = 23;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new DatabaseRowInitializeNew)->addData($input));
     }
 
     /**
@@ -100,6 +90,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'userTsConfig' => [
                 'TCAdefaults.' => [
@@ -118,7 +111,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'aField' => 'userTsValue',
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -131,6 +124,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'userTsConfig' => [
                 'TCAdefaults.' => [
@@ -146,7 +142,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         $expected = [
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -159,6 +155,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'pageTsConfig' => [
                 'TCAdefaults.' => [
@@ -177,7 +176,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'aField' => 'pageTsValue',
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -190,6 +189,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'pageTsConfig' => [
                 'TCAdefaults.' => [
@@ -205,7 +207,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         $expected = [
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -218,6 +220,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'pageTsConfig' => [
                 'TCAdefaults.' => [
@@ -243,7 +248,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'aField' => 'pageTsValue',
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -256,6 +261,8 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'neighborRow' => [
                 'aField' => 'valueFromNeighbor',
@@ -273,7 +280,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'aField' => 'valueFromNeighbor',
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -286,6 +293,8 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'neighborRow' => [
                 'aField' => 'valueFromNeighbor',
@@ -317,7 +326,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'aField' => 'valueFromNeighbor',
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -330,6 +339,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'processedTca' => [
                 'columns' => [
@@ -348,7 +360,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'aField' => 'getValue',
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -361,6 +373,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'processedTca' => [
                 'columns' => [
@@ -379,7 +394,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'aField' => 'postValue',
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -392,6 +407,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'processedTca' => [
                 'columns' => [
@@ -417,7 +435,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'aField' => 'postValue',
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -430,6 +448,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'userTsConfig' => [
                 'TCAdefaults.' => [
@@ -459,7 +480,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         $expected = [
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -472,6 +493,8 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'neighborRow' => [
                 'aField' => 'valueFromNeighbor',
@@ -510,7 +533,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'aField' => 'postValue',
             'pid' => 23,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -521,12 +544,15 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
     {
         $input = [
             'command' => 'new',
+            'tableName' => 'aTable',
+            'neighborRow' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'inlineChildChildUid' => 42,
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1444434102);
-        $this->subject->addData($input);
+        (new DatabaseRowInitializeNew)->addData($input);
     }
 
     /**
@@ -536,12 +562,15 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
     {
         $input = [
             'command' => 'new',
+            'tableName' => 'aTable',
+            'neighborRow' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'inlineChildChildUid' => '42',
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1444434103);
-        $this->subject->addData($input);
+        (new DatabaseRowInitializeNew)->addData($input);
     }
 
     /**
@@ -552,6 +581,8 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         $input = [
             'command' => 'new',
             'tableName' => 'aTable',
+            'neighborRow' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'inlineChildChildUid' => 42,
             'inlineParentConfig' => [
@@ -566,11 +597,12 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
                     ],
                 ],
             ],
+            'vanillaUid' => 5,
         ];
         $expected = $input;
         $expected['databaseRow']['theForeignSelectorField'] = 42;
-        $expected['databaseRow']['pid'] = null;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $expected['databaseRow']['pid'] = 5;
+        $this->assertSame($expected, (new DatabaseRowInitializeNew)->addData($input));
     }
 
     /**
@@ -581,6 +613,8 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         $input = [
             'command' => 'new',
             'tableName' => 'aTable',
+            'neighborRow' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'inlineChildChildUid' => 42,
             'inlineParentConfig' => [
@@ -598,7 +632,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1444434104);
-        $this->subject->addData($input);
+        (new DatabaseRowInitializeNew)->addData($input);
     }
 
     /**
@@ -609,6 +643,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         $input = [
             'command' => 'new',
             'tableName' => 'aTable',
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'databaseRow' => [],
             'inlineParentConfig' => [
                 'inline' => [
@@ -625,7 +662,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1490360772);
-        $this->subject->addData($input);
+        (new DatabaseRowInitializeNew)->addData($input);
     }
 
     /**
@@ -636,6 +673,9 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         $input = [
             'command' => 'new',
             'tableName' => 'aTable',
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
             'vanillaUid' => 1,
             'databaseRow' => [],
             'inlineParentConfig' => [
@@ -656,7 +696,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'sys_language_uid' => 42,
             'pid' => 1,
         ];
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result);
     }
 
@@ -670,9 +710,12 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'tableName' => 'aTable',
             'vanillaUid' => 23,
             'databaseRow' => [],
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
+            'isInlineChild' => false,
         ];
         $expected['pid'] = 23;
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseRowInitializeNew)->addData($input);
         $this->assertSame($expected, $result['databaseRow']);
     }
 
@@ -685,6 +728,8 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
             'databaseRow' => [],
             'pageTsConfig' => [
                 'TCAdefaults.' => [
@@ -697,7 +742,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         ];
         $expected = $input;
         $expected['databaseRow']['pid'] = 23;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new DatabaseRowInitializeNew)->addData($input));
     }
 
     /**
@@ -709,6 +754,8 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
             'databaseRow' => [],
             'pageTsConfig' => [
                 'TCAdefaults.' => [
@@ -721,7 +768,7 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1461598332);
-        $this->subject->addData($input);
+        (new DatabaseRowInitializeNew)->addData($input);
     }
 
     /**
@@ -733,6 +780,8 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
             'command' => 'new',
             'tableName' => 'aTable',
             'vanillaUid' => 23,
+            'neighborRow' => null,
+            'inlineChildChildUid' => null,
             'databaseRow' => [],
             'pageTsConfig' => [
                 'TCAdefaults.' => [
@@ -745,6 +794,6 @@ class DatabaseRowInitializeNewTest extends \TYPO3\TestingFramework\Core\Unit\Uni
         ];
         $expected = $input;
         $expected['databaseRow']['pid'] = 42;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new DatabaseRowInitializeNew)->addData($input));
     }
 }
index d24ff0d..ba8fb8a 100644 (file)
@@ -27,18 +27,14 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class DatabaseSystemLanguageRowsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class DatabaseSystemLanguageRowsTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var DatabaseSystemLanguageRows
      */
     protected $subject;
@@ -69,7 +65,11 @@ class DatabaseSystemLanguageRowsTest extends \TYPO3\TestingFramework\Core\Unit\U
      */
     public function addDataSetsDefaultLanguageAndAllEntries()
     {
+        $input = [
+            'pageTsConfig' => [],
+        ];
         $expected = [
+            'pageTsConfig' => [],
             'systemLanguageRows' => [
                 -1 => [
                     'uid' => -1,
@@ -112,7 +112,7 @@ class DatabaseSystemLanguageRowsTest extends \TYPO3\TestingFramework\Core\Unit\U
         $queryBuilderProphecy->execute()->shouldBeCalled()->willReturn($statementProphecy->reveal());
         $statementProphecy->fetch()->shouldBeCalledTimes(1)->willReturn(false);
 
-        $this->assertSame($expected, $this->subject->addData([]));
+        $this->assertSame($expected, $this->subject->addData($input));
     }
 
     /**
@@ -273,7 +273,12 @@ class DatabaseSystemLanguageRowsTest extends \TYPO3\TestingFramework\Core\Unit\U
 
         $statementProphecy->fetch()->shouldBeCalledTimes(2)->willReturn($aDatabaseResultRow, false);
 
+        $input = [
+            'pageTsConfig' => [],
+        ];
+
         $expected = [
+            'pageTsConfig' => [],
             'systemLanguageRows' => [
                 -1 => [
                     'uid' => -1,
@@ -295,7 +300,7 @@ class DatabaseSystemLanguageRowsTest extends \TYPO3\TestingFramework\Core\Unit\U
                 ],
             ],
         ];
-        $this->assertSame($expected, $this->subject->addData([]));
+        $this->assertSame($expected, $this->subject->addData($input));
     }
 
     /**
@@ -338,9 +343,14 @@ class DatabaseSystemLanguageRowsTest extends \TYPO3\TestingFramework\Core\Unit\U
 
         $statementProphecy->fetch()->shouldBeCalledTimes(2)->willReturn($aDatabaseResultRow, false);
 
+        $input = [
+            'pageTsConfig' => [],
+        ];
+
         // Needed for backendUtility::getRecord()
         $GLOBALS['TCA']['static_languages'] = [ 'foo' ];
         $expected = [
+            'pageTsConfig' => [],
             'systemLanguageRows' => [
                 -1 => [
                     'uid' => -1,
@@ -375,6 +385,6 @@ class DatabaseSystemLanguageRowsTest extends \TYPO3\TestingFramework\Core\Unit\U
 
         $flashMessageQueue->enqueue($flashMessage)->shouldBeCalled();
 
-        $this->assertSame($expected, $this->subject->addData([]));
+        $this->assertSame($expected, $this->subject->addData($input));
     }
 }
index cf65e17..e9594e5 100644 (file)
@@ -26,31 +26,20 @@ use TYPO3\CMS\Backend\Form\Exception\AccessDeniedTableModifyException;
 use TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseUserPermissionCheck;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class DatabaseUserPermissionCheckTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var DatabaseUserPermissionCheck
-     */
-    protected $subject;
-
-    /**
      * @var BackendUserAuthentication | ObjectProphecy
      */
     protected $beUserProphecy;
 
     protected function setUp()
     {
-        $this->subject = new DatabaseUserPermissionCheck();
-
         $this->beUserProphecy = $this->prophesize(BackendUserAuthentication::class);
         $GLOBALS['BE_USER'] = $this->beUserProphecy->reveal();
         $GLOBALS['BE_USER']->user['uid'] = 42;
@@ -63,7 +52,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
     {
         $this->beUserProphecy->isAdmin()->willReturn(true);
 
-        $result = $this->subject->addData([]);
+        $result = (new DatabaseUserPermissionCheck)->addData([]);
 
         $this->assertSame(Permission::ALL, $result['userPermissionOnPage']);
     }
@@ -82,7 +71,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->expectException(AccessDeniedTableModifyException::class);
         $this->expectExceptionCode(1437683248);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 
     /**
@@ -95,17 +84,18 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
             'command' => 'edit',
             'vanillaUid' => 123,
             'parentPageRow' => [
+                'uid' => 42,
                 'pid' => 321,
             ],
         ];
         $this->beUserProphecy->isAdmin()->willReturn(false);
         $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true);
-        $this->beUserProphecy->calcPerms(['pid' => 321])->willReturn(Permission::NOTHING);
+        $this->beUserProphecy->calcPerms(['uid' => 42, 'pid' => 321])->willReturn(Permission::NOTHING);
 
         $this->expectException(AccessDeniedContentEditException::class);
         $this->expectExceptionCode(1437679657);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 
     /**
@@ -117,6 +107,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
             'tableName' => 'tt_content',
             'command' => 'edit',
             'vanillaUid' => 123,
+            'databaseRow' => [],
             'parentPageRow' => [
                 'pid' => 321,
             ],
@@ -126,7 +117,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->beUserProphecy->calcPerms(['pid' => 321])->willReturn(Permission::CONTENT_EDIT);
         $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::any())->willReturn(true);
 
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseUserPermissionCheck)->addData($input);
 
         $this->assertSame(Permission::CONTENT_EDIT, $result['userPermissionOnPage']);
     }
@@ -152,7 +143,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->expectException(AccessDeniedPageEditException::class);
         $this->expectExceptionCode(1437679336);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 
     /**
@@ -184,7 +175,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->expectException(AccessDeniedPageEditException::class);
         $this->expectExceptionCode(1437679336);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 
     /**
@@ -213,7 +204,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->beUserProphecy->calcPerms($input['databaseRow'])->willReturn(Permission::PAGE_EDIT);
         $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(true);
 
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseUserPermissionCheck)->addData($input);
 
         $this->assertSame(Permission::PAGE_EDIT, $result['userPermissionOnPage']);
     }
@@ -237,7 +228,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(true);
         $GLOBALS['TCA'][$input['tableName']]['ctrl']['security']['ignoreRootLevelRestriction'] = true;
 
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseUserPermissionCheck)->addData($input);
 
         $this->assertSame(Permission::ALL, $result['userPermissionOnPage']);
     }
@@ -263,7 +254,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->expectException(AccessDeniedRootNodeException::class);
         $this->expectExceptionCode(1437679856);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 
     /**
@@ -275,6 +266,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
             'tableName' => 'tt_content',
             'command' => 'edit',
             'vanillaUid' => 123,
+            'databaseRow' => [],
             'parentPageRow' => [
                 'uid' => 123,
                 'pid' => 321,
@@ -288,7 +280,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->expectException(AccessDeniedEditInternalsException::class);
         $this->expectExceptionCode(1437687404);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 
     /**
@@ -312,7 +304,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->expectException(AccessDeniedContentEditException::class);
         $this->expectExceptionCode(1437745759);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 
     /**
@@ -324,6 +316,9 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
             'tableName' => 'pages',
             'command' => 'new',
             'vanillaUid' => 123,
+            'databaseRow' => [
+                'uid' => 'NEW123',
+            ],
             'parentPageRow' => [
                 'uid' => 123,
                 'pid' => 321,
@@ -336,7 +331,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->expectException(AccessDeniedPageNewException::class);
         $this->expectExceptionCode(1437745640);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 
     /**
@@ -348,6 +343,9 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
             'tableName' => 'tt_content',
             'command' => 'edit',
             'vanillaUid' => 123,
+            'databaseRow' => [
+                'uid' => 5,
+            ],
             'parentPageRow' => [
                 'uid' => 123,
                 'pid' => 321,
@@ -367,7 +365,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->expectException(AccessDeniedHookException::class);
         $this->expectExceptionCode(1437689705);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 
     /**
@@ -379,6 +377,9 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
             'tableName' => 'pages',
             'command' => 'new',
             'vanillaUid' => 123,
+            'databaseRow' => [
+                'uid' => 'NEW5',
+            ],
             'parentPageRow' => [
                 'uid' => 123,
                 'pid' => 321,
@@ -395,7 +396,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
             }
         ];
 
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseUserPermissionCheck)->addData($input);
 
         $this->assertSame(Permission::CONTENT_EDIT, $result['userPermissionOnPage']);
     }
@@ -419,7 +420,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->beUserProphecy->calcPerms($input['parentPageRow'])->willReturn(Permission::PAGE_NEW);
         $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(true);
 
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseUserPermissionCheck)->addData($input);
 
         $this->assertSame(Permission::PAGE_NEW, $result['userPermissionOnPage']);
     }
@@ -443,7 +444,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->beUserProphecy->calcPerms($input['parentPageRow'])->willReturn(Permission::CONTENT_EDIT);
         $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(true);
 
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseUserPermissionCheck)->addData($input);
 
         $this->assertSame(Permission::CONTENT_EDIT, $result['userPermissionOnPage']);
     }
@@ -464,7 +465,7 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(true);
         $GLOBALS['TCA'][$input['tableName']]['ctrl']['security']['ignoreRootLevelRestriction'] = true;
 
-        $result = $this->subject->addData($input);
+        $result = (new DatabaseUserPermissionCheck)->addData($input);
 
         $this->assertSame(Permission::ALL, $result['userPermissionOnPage']);
     }
@@ -487,6 +488,6 @@ class DatabaseUserPermissionCheckTest extends \TYPO3\TestingFramework\Core\Unit\
         $this->expectException(AccessDeniedRootNodeException::class);
         $this->expectExceptionCode(1437745221);
 
-        $this->subject->addData($input);
+        (new DatabaseUserPermissionCheck)->addData($input);
     }
 }
index 74333ed..7f3a7e0 100644 (file)
@@ -19,18 +19,14 @@ use Prophecy\Prophecy\ObjectProphecy;
 use TYPO3\CMS\Backend\Form\FormDataProvider\EvaluateDisplayConditions;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class EvaluateDisplayConditionsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class EvaluateDisplayConditionsTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @test
      */
     public function addDataThrowsExceptionIfMultipleConditionsAreNotCombinedWithAndOrOr()
@@ -3761,6 +3757,9 @@ class EvaluateDisplayConditionsTest extends \TYPO3\TestingFramework\Core\Unit\Un
             ]
         ];
 
+        $backendUserAuthenticationProphecy = $this->prophesize(BackendUserAuthentication::class);
+        $GLOBALS['BE_USER'] = $backendUserAuthenticationProphecy->reveal();
+
         $expected = $input;
         if ($expectedResult) {
             // displayCond vanished from result array after this data provider is done
@@ -3792,7 +3791,18 @@ class EvaluateDisplayConditionsTest extends \TYPO3\TestingFramework\Core\Unit\Un
                 ],
             ],
         ];
-        $input['databaseRow'] = $record ?: ['testField' => ['key' => $record['testField']]];
+
+        $input['databaseRow'] = $record;
+        if (!empty($record['testField'])) {
+            $input['databaseRow'] = [
+                'testField' => [
+                    'key' => $record['testField']
+                ]
+            ];
+        }
+
+        $backendUserAuthenticationProphecy = $this->prophesize(BackendUserAuthentication::class);
+        $GLOBALS['BE_USER'] = $backendUserAuthenticationProphecy->reveal();
 
         $expected = $input;
         if ($expectedResult) {
index 2617288..ec0a425 100644 (file)
@@ -22,23 +22,14 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaCheckboxItemsTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaCheckboxItems
-     */
-    protected $subject;
-
-    /**
      * @var array A backup of registered singleton instances
      */
     protected $singletonInstances = [];
@@ -46,7 +37,6 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
     protected function setUp()
     {
         $this->singletonInstances = GeneralUtility::getSingletonInstances();
-        $this->subject = new TcaCheckboxItems();
     }
 
     protected function tearDown()
@@ -56,19 +46,6 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
         parent::tearDown();
     }
 
-    /**
-     * @test
-     * @dataProvider checkboxConfigurationDataProvider
-     */
-    public function addDataKeepExistingItems($input, $expectedResult)
-    {
-        $languageService = $this->prophesize(LanguageService::class);
-        $GLOBALS['LANG'] = $languageService->reveal();
-        $languageService->sL(Argument::cetera())->willReturnArgument(0);
-
-        $this->assertSame($expectedResult, $this->subject->addData($input));
-    }
-
     public function checkboxConfigurationDataProvider()
     {
         return [
@@ -429,6 +406,19 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
 
     /**
      * @test
+     * @dataProvider checkboxConfigurationDataProvider
+     */
+    public function addDataKeepExistingItems($input, $expectedResult)
+    {
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
+        $this->assertSame($expectedResult, (new TcaCheckboxItems)->addData($input));
+    }
+
+    /**
+     * @test
      */
     public function addDataThrowsExceptionIfItemsAreNoArray()
     {
@@ -447,9 +437,14 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
             ],
             'tableName' => 'foo'
         ];
+
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1440499337);
-        $this->subject->addData($input);
+        (new TcaCheckboxItems)->addData($input);
     }
 
     /**
@@ -474,9 +469,14 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
             ],
             'tableName' => 'foo'
         ];
+
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1440499338);
-        $this->subject->addData($input);
+        (new TcaCheckboxItems)->addData($input);
     }
 
     /**
@@ -513,8 +513,7 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
         $expected['processedTca']['columns']['aField']['config']['items'][0][0] = 'translated';
         $expected['processedTca']['columns']['aField']['config']['items'][0]['invertStateDisplay'] = false;
 
-        $this->assertSame($expected, $this->subject->addData($input));
-        $this->subject->addData($input);
+        $this->assertSame($expected, (new TcaCheckboxItems)->addData($input));
     }
 
     /**
@@ -541,6 +540,11 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
                 ],
             ],
         ];
+
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $expected = $input;
         $expected['processedTca']['columns']['aField']['config'] = [
             'type' => 'check',
@@ -548,7 +552,7 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
                 'foo' => 'bar',
             ],
         ];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaCheckboxItems)->addData($input));
     }
 
     /**
@@ -623,7 +627,7 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
         // itemsProcFunc must NOT have raised an exception
         $flashMessageQueue->enqueue($flashMessage)->shouldNotBeCalled();
 
-        $this->subject->addData($input);
+        (new TcaCheckboxItems)->addData($input);
     }
 
     /**
@@ -682,7 +686,7 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
 
         $flashMessageQueue->enqueue($flashMessage)->shouldBeCalled();
 
-        $this->subject->addData($input);
+        (new TcaCheckboxItems)->addData($input);
     }
 
     /**
@@ -731,7 +735,6 @@ class TcaCheckboxItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas
         $expected['processedTca']['columns']['aField']['config']['items'][0][0] = 'labelOverride';
         $expected['processedTca']['columns']['aField']['config']['items'][0]['invertStateDisplay'] = false;
 
-        $this->assertSame($expected, $this->subject->addData($input));
-        $this->subject->addData($input);
+        $this->assertSame($expected, (new TcaCheckboxItems)->addData($input));
     }
 }
index 8add486..d1ba6ec 100644 (file)
@@ -15,33 +15,20 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessCommon;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaColumnsProcessCommonTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaColumnsProcessCommon
-     */
-    protected $subject;
-
-    protected function setUp()
-    {
-        $this->subject = new TcaColumnsProcessCommon();
-    }
-
-    /**
      * @test
      */
     public function addDataRegistersOrigUidColumn()
     {
         $input = [
+            'recordTypeValue' => 'aType',
             'columnsToProcess' => [],
             'processedTca' => [
                 'ctrl' => [
@@ -52,7 +39,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['t3_origuid'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessCommon)->addData($input));
     }
 
     /**
@@ -61,6 +48,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     public function addDataRegistersRecordTypeColumn()
     {
         $input = [
+            'recordTypeValue' => 'aType',
             'columnsToProcess' => [],
             'processedTca' => [
                 'ctrl' => [
@@ -71,7 +59,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['doktype'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessCommon)->addData($input));
     }
 
     /**
@@ -80,6 +68,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     public function addDataRegistersRecordTypeRelationColumn()
     {
         $input = [
+            'recordTypeValue' => 'aType',
             'columnsToProcess' => [],
             'processedTca' => [
                 'ctrl' => [
@@ -90,7 +79,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['relation_field'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessCommon)->addData($input));
     }
 
     /**
@@ -99,6 +88,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     public function addDataRegistersLanguageFieldColumn()
     {
         $input = [
+            'recordTypeValue' => 'aType',
             'columnsToProcess' => [],
             'processedTca' => [
                 'ctrl' => [
@@ -109,7 +99,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['sys_language_uid'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessCommon)->addData($input));
     }
 
     /**
@@ -118,6 +108,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     public function addDataRegistersTransOrigPointerColumn()
     {
         $input = [
+            'recordTypeValue' => 'aType',
             'columnsToProcess' => [],
             'processedTca' => [
                 'ctrl' => [
@@ -128,7 +119,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['l10n_parent'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessCommon)->addData($input));
     }
 
     /**
@@ -137,6 +128,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
     public function addDataRegistersTransOrigDiffSourceColumn()
     {
         $input = [
+            'recordTypeValue' => 'aType',
             'columnsToProcess' => [],
             'processedTca' => [
                 'ctrl' => [
@@ -147,7 +139,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['l18n_diffsource'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessCommon)->addData($input));
     }
 
     /**
@@ -159,6 +151,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
             'recordTypeValue' => 'list',
             'columnsToProcess' => [],
             'processedTca' => [
+                'ctrl' => [],
                 'types' => [
                     'list' => [
                         'subtype_value_field' => 'list_type',
@@ -175,7 +168,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['aField'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessCommon)->addData($input));
     }
 
     /**
@@ -187,6 +180,7 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
             'recordTypeValue' => 'aType',
             'columnsToProcess' => [],
             'processedTca' => [
+                'ctrl' => [],
                 'types' => [
                     'aType' => [
                         'subtype_value_field' => 'theSubtypeValueField',
@@ -203,6 +197,6 @@ class TcaColumnsProcessCommonTest extends \TYPO3\TestingFramework\Core\Unit\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['aField', 'bField'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessCommon)->addData($input));
     }
 }
index a24d68f..c3992ce 100644 (file)
@@ -16,33 +16,20 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
 
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessFieldLabels;
 use TYPO3\CMS\Core\Localization\LanguageService;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaColumnsProcessFieldLabelsTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaColumnsProcessFieldLabels
-     */
-    protected $subject;
-
-    protected function setUp()
-    {
-        $this->subject = new TcaColumnsProcessFieldLabels();
-    }
-
-    /**
      * @test
      */
     public function addDataKeepsLabelAsIsIfNoOverrideIsGiven()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -50,13 +37,14 @@ class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit
                     ],
                 ],
             ],
+            'recordTypeValue' => 'aType',
         ];
         $languageServiceProphecy = $this->prophesize(LanguageService::class);
         $languageServiceProphecy->sL('foo')->shouldBeCalled()->willReturnArgument(0);
         $GLOBALS['LANG'] = $languageServiceProphecy->reveal();
 
         $expected = $input;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessFieldLabels)->addData($input));
     }
 
     /**
@@ -65,6 +53,7 @@ class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit
     public function addDataSetsLabelFromShowitem()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -85,7 +74,7 @@ class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit
 
         $expected = $input;
         $expected['processedTca']['columns']['aField']['label'] = 'aLabelOverride';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessFieldLabels)->addData($input));
     }
 
     /**
@@ -94,6 +83,7 @@ class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit
     public function addDataSetsLabelFromPalettesShowitem()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -119,7 +109,7 @@ class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit
 
         $expected = $input;
         $expected['processedTca']['columns']['aField']['label'] = 'aLabelOverride';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessFieldLabels)->addData($input));
     }
 
     /**
@@ -145,6 +135,7 @@ class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit
                     ],
                 ],
             ],
+            'recordTypeValue' => 'aType',
         ];
         $languageServiceProphecy = $this->prophesize(LanguageService::class);
         $languageServiceProphecy->sL('aLabelOverride')->shouldBeCalled()->willReturnArgument(0);
@@ -152,7 +143,7 @@ class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit
 
         $expected = $input;
         $expected['processedTca']['columns']['aField']['label'] = 'aLabelOverride';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessFieldLabels)->addData($input));
     }
 
     /**
@@ -180,6 +171,7 @@ class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit
                     ],
                 ],
             ],
+            'recordTypeValue' => 'aType',
         ];
         $languageServiceProphecy = $this->prophesize(LanguageService::class);
         $languageServiceProphecy->lang = 'fr';
@@ -188,6 +180,6 @@ class TcaColumnsProcessFieldLabelsTest extends \TYPO3\TestingFramework\Core\Unit
 
         $expected = $input;
         $expected['processedTca']['columns']['aField']['label'] = 'aLabelOverride';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessFieldLabels)->addData($input));
     }
 }
index 3df172a..ba9e90f 100644 (file)
@@ -15,34 +15,21 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessRecordTitle;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaColumnsProcessRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaColumnsProcessRecordTitleTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaColumnsProcessRecordTitle
-     */
-    protected $subject;
-
-    protected function setUp()
-    {
-        $this->subject = new TcaColumnsProcessRecordTitle();
-    }
-
-    /**
      * @test
      */
     public function addDataRegistersLabelColumn()
     {
         $input = [
             'columnsToProcess' => [],
+            'isInlineChild' => false,
             'processedTca' => [
                 'ctrl' => [
                     'label' => 'uid'
@@ -53,7 +40,7 @@ class TcaColumnsProcessRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['uid'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessRecordTitle)->addData($input));
     }
 
     /**
@@ -63,6 +50,7 @@ class TcaColumnsProcessRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit
     {
         $input = [
             'columnsToProcess' => [],
+            'isInlineChild' => false,
             'processedTca' => [
                 'ctrl' => [
                     'label' => 'uid',
@@ -74,7 +62,7 @@ class TcaColumnsProcessRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = ['uid', 'aField', 'anotherField'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessRecordTitle)->addData($input));
     }
 
     /**
@@ -92,7 +80,7 @@ class TcaColumnsProcessRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = [ 'aForeignLabelField' ];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessRecordTitle)->addData($input));
     }
 
     /**
@@ -110,6 +98,6 @@ class TcaColumnsProcessRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit
 
         $expected = $input;
         $expected['columnsToProcess'] = [ 'aSymmetricLabelField' ];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessRecordTitle)->addData($input));
     }
 }
index e0cfb13..22f2608 100644 (file)
@@ -15,34 +15,21 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessShowitem;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaColumnsProcessShowitemTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaColumnsProcessShowitem
-     */
-    protected $subject;
-
-    protected function setUp()
-    {
-        $this->subject = new TcaColumnsProcessShowitem();
-    }
-
-    /**
      * @test
      */
     public function addDataThrowsExceptionIfTypesHasNoShowitem()
     {
         $input = [
             'recordTypeValue' => 'aType',
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -56,7 +43,7 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1438614542);
-        $this->subject->addData($input);
+        (new TcaColumnsProcessShowitem)->addData($input);
     }
 
     /**
@@ -68,6 +55,7 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
             'columnsToProcess' => [],
             'databaseRow' => [],
             'recordTypeValue' => 'aType',
+            'isInlineChild' => false,
             'processedTca' => [
                 'types' => [
                     'aType' => [
@@ -92,7 +80,7 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
         $expected = $input;
         $expected['columnsToProcess'] = ['keepMe'];
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessShowitem)->addData($input));
     }
 
     /**
@@ -104,6 +92,7 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
             'columnsToProcess' => [],
             'databaseRow' => [],
             'recordTypeValue' => 'aType',
+            'isInlineChild' => false,
             'processedTca' => [
                 'types' => [
                     'aType' => [
@@ -133,7 +122,7 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
         $expected = $input;
         $expected['columnsToProcess'] = ['keepMe'];
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessShowitem)->addData($input));
     }
 
     /**
@@ -144,6 +133,7 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
         $input = [
             'databaseRow' => [],
             'recordTypeValue' => 'aType',
+            'isInlineChild' => false,
             'processedTca' => [
                 'types' => [
                     'aType' => [
@@ -178,7 +168,7 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
         $expected = $input;
         $expected['columnsToProcess'] = ['aField', 'anotherField'];
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessShowitem)->addData($input));
     }
 
     /**
@@ -210,11 +200,12 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
                 'foreign_table' => 'aTable',
             ],
             'isInlineChild' => true,
+            'isInlineChildExpanded' => false,
             'isInlineAjaxOpeningContext' => false,
             'inlineExpandCollapseStateArray' => [],
         ];
         $expected = $input;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessShowitem)->addData($input));
     }
 
     /**
@@ -258,7 +249,7 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
             ],
         ];
         $expected = $input;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessShowitem)->addData($input));
     }
 
     /**
@@ -300,6 +291,6 @@ class TcaColumnsProcessShowitemTest extends \TYPO3\TestingFramework\Core\Unit\Un
         ];
         $expected = $input;
         $expected['columnsToProcess'] = ['aField'];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaColumnsProcessShowitem)->addData($input));
     }
 }
index 0ce65f1..2984a19 100644 (file)
@@ -17,32 +17,17 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
 use Prophecy\Argument;
 use Prophecy\Prophecy\ObjectProphecy;
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaFlexPrepare;
-use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaFlexPrepareTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaFlexPrepareTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaFlexPrepare
-     */
-    protected $subject;
-
-    /**
-     * @var BackendUserAuthentication|ObjectProphecy
-     */
-    protected $backendUserProphecy;
-
-    /**
      * @var array A backup of registered singleton instances
      */
     protected $singletonInstances = [];
@@ -57,8 +42,6 @@ class TcaFlexPrepareTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
         $cacheFrontendProphecy = $this->prophesize(FrontendInterface::class);
         $cacheManagerProphecy->getCache(Argument::cetera())->willReturn($cacheFrontendProphecy->reveal());
-
-        $this->subject = new TcaFlexPrepare();
     }
 
     protected function tearDown()
@@ -112,7 +95,7 @@ class TcaFlexPrepareTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ],
         ];
         $expected = $input;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaFlexPrepare)->addData($input));
     }
 
     /**
@@ -183,7 +166,7 @@ class TcaFlexPrepareTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'meta' => [],
         ];
 
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaFlexPrepare)->addData($input));
     }
 
     /**
@@ -262,7 +245,7 @@ class TcaFlexPrepareTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'meta' => [],
         ];
 
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaFlexPrepare)->addData($input));
     }
 
     /**
@@ -306,6 +289,6 @@ class TcaFlexPrepareTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'meta' => []
         ];
 
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaFlexPrepare)->addData($input));
     }
 }
index a222ef9..2fcde65 100644 (file)
@@ -21,18 +21,14 @@ use TYPO3\CMS\Backend\Form\FormDataProvider\TcaFlexProcess;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaFlexProcessTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var BackendUserAuthentication|ObjectProphecy
      */
     protected $backendUserProphecy;
@@ -146,7 +142,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -225,7 +223,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -304,7 +304,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -383,7 +385,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -462,7 +466,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -525,7 +531,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -596,7 +604,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -667,7 +677,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -740,7 +752,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -846,7 +860,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -1007,7 +1023,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [
                         'sDEF' => [
@@ -1354,7 +1372,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
@@ -1413,7 +1433,9 @@ class TcaFlexProcessTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'selectTreeCompileItems' => false,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => [
                     'data' => [],
                 ],
index e1b6b4c..8293032 100644 (file)
@@ -17,34 +17,25 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
 use Prophecy\Prophecy\ObjectProphecy;
 use TYPO3\CMS\Backend\Clipboard\Clipboard;
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaGroup;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\RelationHandler;
 use TYPO3\CMS\Core\Resource\Folder;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaGroupTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaGroup
-     */
-    protected $subject;
-
-    /**
      * @var array
      */
     protected $singletonInstances;
 
     protected function setUp()
     {
-        $this->subject = new TcaGroup();
         $this->singletonInstances = GeneralUtility::getSingletonInstances();
     }
 
@@ -74,7 +65,7 @@ class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ],
         ];
         $expected = $input;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaGroup)->addData($input));
     }
 
     /**
@@ -83,6 +74,7 @@ class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     public function addDataThrowsExceptionWithTypeGroupAndNoValidInternalType()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -96,7 +88,7 @@ class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1438780511);
-        $this->subject->addData($input);
+        (new TcaGroup)->addData($input);
     }
 
     /**
@@ -132,7 +124,7 @@ class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $clipboardProphecy->initializeClipboard()->shouldBeCalled();
         $clipboardProphecy->elFromTable('_FILE')->shouldBeCalled()->willReturn([]);
 
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaGroup)->addData($input));
     }
 
     /**
@@ -175,7 +167,7 @@ class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         ];
         $expected['processedTca']['columns']['aField']['config']['clipboardElements'] = [];
         $expected['processedTca']['columns']['aField']['config']['allowed'] = '*';
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaGroup)->addData($input));
     }
 
     /**
@@ -217,7 +209,7 @@ class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ]
         ];
         $expected['processedTca']['columns']['aField']['config']['clipboardElements'] = [];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaGroup)->addData($input));
     }
 
     /**
@@ -247,6 +239,9 @@ class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ],
         ];
 
+        $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class);
+        $GLOBALS['BE_USER'] = $backendUserProphecy->reveal();
+
         $clipboardProphecy = $this->prophesize(Clipboard::class);
         GeneralUtility::addInstance(Clipboard::class, $clipboardProphecy->reveal());
         $clipboardProphecy->initializeClipboard()->shouldBeCalled();
@@ -285,6 +280,6 @@ class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         ];
         $expected['processedTca']['columns']['aField']['config']['clipboardElements'] = [];
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaGroup)->addData($input));
     }
 }
index 7a96acb..a1fb338 100644 (file)
@@ -15,28 +15,14 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaInlineConfiguration;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaInlineConfigurationTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaInlineConfiguration
-     */
-    protected $subject;
-
-    protected function setUp()
-    {
-        $this->subject = new TcaInlineConfiguration();
-    }
-
-    /**
      * @var array Set of default controls
      */
     protected $defaultConfig = [
@@ -66,6 +52,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
     public function addDataThrowsExceptionForInlineFieldWithoutForeignTableConfig()
     {
         $input = [
+            'tableName' => 'aTable',
             'databaseRow' => [],
             'processedTca' => [
                 'columns' => [
@@ -79,7 +66,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1443793404);
-        $this->subject->addData($input);
+        (new TcaInlineConfiguration)->addData($input);
     }
 
     /**
@@ -100,7 +87,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
             ],
         ];
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -123,7 +110,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
         $expected['processedTca']['columns']['aField']['config']['minitems'] = 23;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -146,7 +133,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
         $expected['processedTca']['columns']['aField']['config']['minitems'] = 0;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -169,7 +156,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
         $expected['processedTca']['columns']['aField']['config']['maxitems'] = 23;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -192,7 +179,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
         $expected['processedTca']['columns']['aField']['config']['maxitems'] = 1;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -221,7 +208,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
         $expected['processedTca']['columns']['aField']['config']['appearance']['levelLinksPosition'] = 'both';
         $expected['processedTca']['columns']['aField']['config']['appearance']['enabledControls']['dragdrop'] = false;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -262,7 +249,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
             'foreignTable' => 'anotherForeignTableName',
         ];
         $expected['processedTca']['columns']['aField']['config']['appearance']['levelLinksPosition'] = 'none';
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -305,7 +292,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $expected['processedTca']['columns']['aField']['config']['appearance']['useCombination'] = true;
         $expected['processedTca']['columns']['aField']['config']['appearance']['levelLinksPosition'] = 'both';
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -330,7 +317,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
         $expected['processedTca']['columns']['aField']['config']['appearance']['showPossibleLocalizationRecords'] = true;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -355,7 +342,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
         $expected['processedTca']['columns']['aField']['config']['appearance']['showPossibleLocalizationRecords'] = false;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -380,7 +367,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
         $expected['processedTca']['columns']['aField']['config']['appearance']['showRemovedLocalizationRecords'] = true;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -405,7 +392,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
         $expected['processedTca']['columns']['aField']['config']['appearance']['showRemovedLocalizationRecords'] = false;
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -414,6 +401,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
     public function addDataThrowsExceptionIfForeignSelectorAndForeignUniquePointToDifferentFields()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -429,7 +417,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1444995464);
-        $this->subject->addData($input);
+        (new TcaInlineConfiguration)->addData($input);
     }
 
     /**
@@ -438,6 +426,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
     public function addDataThrowsExceptionIfForeignSelectorPointsToANotExistingField()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -452,7 +441,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1444996537);
-        $this->subject->addData($input);
+        (new TcaInlineConfiguration)->addData($input);
     }
 
     /**
@@ -461,6 +450,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
     public function addDataThrowsExceptionIfForeignUniquePointsToANotExistingField()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -475,7 +465,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1444996537);
-        $this->subject->addData($input);
+        (new TcaInlineConfiguration)->addData($input);
     }
 
     /**
@@ -484,6 +474,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
     public function addDataThrowsExceptionIfForeignUniqueTargetIsNotTypeSelectOrGroup()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -501,7 +492,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1444996537);
-        $this->subject->addData($input);
+        (new TcaInlineConfiguration)->addData($input);
     }
 
     /**
@@ -510,6 +501,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
     public function addDataThrowsExceptionForForeignSelectorGroupWithoutInternalTypeDb()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -528,7 +520,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1444999130);
-        $this->subject->addData($input);
+        (new TcaInlineConfiguration)->addData($input);
     }
 
     /**
@@ -537,6 +529,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
     public function addDataThrowsExceptionIfForeignUniqueSelectDoesNotDefineForeignTable()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -554,7 +547,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1445078627);
-        $this->subject->addData($input);
+        (new TcaInlineConfiguration)->addData($input);
     }
 
     /**
@@ -563,6 +556,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
     public function addDataThrowsExceptionIfForeignUniqueGroupDoesNotDefineForeignTable()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -581,7 +575,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1445078628);
-        $this->subject->addData($input);
+        (new TcaInlineConfiguration)->addData($input);
     }
 
     /**
@@ -618,7 +612,7 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
             ],
             'foreignTable' => 'anotherForeignTableName',
         ];
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 
     /**
@@ -693,6 +687,6 @@ class TcaInlineConfigurationTest extends \TYPO3\TestingFramework\Core\Unit\UnitT
             ],
             'foreignTable' => 'anotherForeignTableName',
         ];
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInlineConfiguration)->addData($input));
     }
 }
index f4c11e0..787a851 100644 (file)
@@ -15,28 +15,15 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaInlineExpandCollapseState;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaInlineExpandCollapseStateTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaInlineExpandCollapseState
-     */
-    protected $subject;
-
-    protected function setUp()
-    {
-        $this->subject = new TcaInlineExpandCollapseState();
-    }
-
-    /**
      * @test
      */
     public function addDataAddsInlineStatusForTableUid()
@@ -47,6 +34,11 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
             'databaseRow' => [
                 'uid' => 5,
             ],
+            'isInlineChildExpanded' => false,
+            'inlineParentConfig' => [
+                'foreign_table' => 'aTable',
+            ],
+            'isInlineAjaxOpeningContext' => false,
         ];
         $inlineState = [
             'aParentTable' => [
@@ -65,7 +57,7 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
         ];
         $expected = $input;
         $expected['inlineExpandCollapseStateArray'] = $inlineState['aParentTable'][5];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInlineExpandCollapseState)->addData($input));
     }
 
     /**
@@ -81,6 +73,11 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
             ],
             'inlineTopMostParentTableName' => 'aParentTable',
             'inlineTopMostParentUid' => 5,
+            'isInlineChildExpanded' => false,
+            'inlineParentConfig' => [
+                'foreign_table' => 'aTable',
+            ],
+            'isInlineAjaxOpeningContext' => false,
         ];
         $inlineState = [
             'aParentTable' => [
@@ -104,7 +101,7 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
         ];
         $expected = $input;
         $expected['inlineExpandCollapseStateArray'] = $inlineState['aParentTable'][5];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInlineExpandCollapseState)->addData($input));
     }
 
     /**
@@ -151,6 +148,7 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
             'Inline child is expanded because of ajax opening context' => [
                 [
                     'command' => 'edit',
+                    'tableName' => 'aParentTable',
                     'databaseRow' => [
                         'uid' => 42,
                     ],
@@ -185,6 +183,7 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
             'Inline child is collapsed because of collapseAll' => [
                 [
                     'command' => 'edit',
+                    'tableName' => 'aParentTable',
                     'databaseRow' => [
                         'uid' => 42,
                     ],
@@ -211,6 +210,7 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
                     ],
                     'isInlineChild' => true,
                     'isInlineChildExpanded' => false,
+                    'isInlineAjaxOpeningContext' => false,
                     'inlineExpandCollapseStateArray' => [],
                 ],
                 false
@@ -218,6 +218,7 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
             'Inline child is expanded because of expandAll (inverse collapseAll setting)' => [
                 [
                     'command' => 'edit',
+                    'tableName' => 'aParentTable',
                     'databaseRow' => [
                         'uid' => 42,
                     ],
@@ -285,6 +286,7 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
             'Inline child marked as expanded stays expanded (e.g. combination child)' => [
                 [
                     'command' => 'edit',
+                    'tableName' => 'aParentTable',
                     'databaseRow' => [
                         'uid' => 42,
                     ],
@@ -327,8 +329,11 @@ class TcaInlineExpandCollapseStateTest extends \TYPO3\TestingFramework\Core\Unit
      */
     public function addDataAddsCorrectIsInlineChildExpanded(array $input, $expectedIsInlineChildExpanded)
     {
+        $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class);
+        $GLOBALS['BE_USER'] = $backendUserProphecy->reveal();
+
         $expected = $input;
         $expected['isInlineChildExpanded'] = $expectedIsInlineChildExpanded;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInlineExpandCollapseState)->addData($input));
     }
 }
index aa68500..fc8ae00 100644 (file)
@@ -17,23 +17,14 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
 use Prophecy\Prophecy\ObjectProphecy;
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaInline;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaInlineTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaInlineTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaInline
-     */
-    protected $subject;
-
-    /**
      * @var BackendUserAuthentication | ObjectProphecy
      */
     protected $beUserProphecy;
@@ -42,28 +33,9 @@ class TcaInlineTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $this->beUserProphecy = $this->prophesize(BackendUserAuthentication::class);
         $GLOBALS['BE_USER'] = $this->beUserProphecy->reveal();
-
-        $this->subject = new TcaInline();
     }
 
     /**
-     * @var array Set of default controls
-     */
-    protected $defaultConfig = [
-        'processedTca' => [
-            'columns' => [
-                'aField' => [
-                    'config' => [
-                        'type' => 'inline',
-                        'foreign_table' => 'aForeignTableName'
-                    ],
-                ],
-            ],
-        ],
-        'inlineFirstPid' => 0,
-    ];
-
-    /**
      * @test
      */
     public function addDataWithoutModifyRightsButWithInlineTypeWillNotParseChildren()
@@ -79,6 +51,7 @@ class TcaInlineTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                     ],
                 ],
             ],
+            'inlineFirstPid' => 0,
         ];
 
         $this->beUserProphecy
@@ -89,9 +62,9 @@ class TcaInlineTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ->shouldBeCalled()
             ->willReturn(false);
 
-        $expected = $this->defaultConfig;
+        $expected = $input;
         $expected['processedTca']['columns']['aField']['children'] = [];
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInline)->addData($input));
     }
 
     /**
@@ -110,6 +83,7 @@ class TcaInlineTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                     ],
                 ],
             ],
+            'inlineFirstPid' => 0,
         ];
 
         $this->beUserProphecy
@@ -119,9 +93,9 @@ class TcaInlineTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             )
             ->shouldNotBeCalled();
 
-        $expected = $this->defaultConfig;
+        $expected = $input;
         $expected['processedTca']['columns']['aField']['config']['type'] = 'input';
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInline)->addData($input));
     }
 
     /**
@@ -140,6 +114,8 @@ class TcaInlineTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                     ],
                 ],
             ],
+            'inlineFirstPid' => 0,
+            'inlineResolveExistingChildren' => false,
         ];
 
         $this->beUserProphecy
@@ -150,8 +126,8 @@ class TcaInlineTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ->shouldBeCalled()
             ->willReturn(true);
 
-        $expected = $this->defaultConfig;
+        $expected = $input;
         $expected['processedTca']['columns']['aField']['children'] = [];
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaInline)->addData($input));
     }
 }
index 81c076f..be9e2df 100644 (file)
@@ -20,28 +20,14 @@ use TYPO3\CMS\Backend\Form\FormDataGroup\TcaInputPlaceholderRecord;
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaInputPlaceholders;
 use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaInputPlaceholdersTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaInputPlaceholders
-     */
-    protected $subject;
-
-    public function setUp()
-    {
-        $this->subject = new TcaInputPlaceholders();
-    }
-
-    /**
      * @test
      */
     public function addDataRemovesEmptyPlaceholderOption()
@@ -64,7 +50,7 @@ class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
         $expected = $input;
         unset($expected['processedTca']['columns']['aField']['config']['placeholder']);
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInputPlaceholders)->addData($input));
     }
 
     /**
@@ -89,7 +75,7 @@ class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
 
         $expected = $input;
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInputPlaceholders)->addData($input));
     }
 
     /**
@@ -117,7 +103,7 @@ class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
         $expected = $input;
         $expected['processedTca']['columns']['aField']['config']['placeholder'] = 'anotherPlaceholder';
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInputPlaceholders)->addData($input));
     }
 
     /**
@@ -181,7 +167,7 @@ class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
         $expected = $input;
         $expected['processedTca']['columns']['aField']['config']['placeholder'] = $aForeignTableInput['databaseRow']['aForeignField'];
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInputPlaceholders)->addData($input));
     }
 
     /**
@@ -216,7 +202,7 @@ class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
         $expected = $input;
         unset($expected['processedTca']['columns']['aField']['config']['placeholder']);
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInputPlaceholders)->addData($input));
     }
 
     /**
@@ -290,7 +276,7 @@ class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
         $expected = $input;
         $expected['processedTca']['columns']['aField']['config']['placeholder'] = $sysFileProphecyResult['databaseRow']['sha1'];
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInputPlaceholders)->addData($input));
     }
 
     /**
@@ -356,7 +342,7 @@ class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
         $expected = $input;
         $expected['processedTca']['columns']['aField']['config']['placeholder'] = $sysFileMetadataProphecyResult['databaseRow']['title'];
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInputPlaceholders)->addData($input));
     }
 
     /**
@@ -460,7 +446,7 @@ class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
         $expected = $input;
         $expected['processedTca']['columns']['aField']['config']['placeholder'] = $sysFileMetadataProphecyResult['databaseRow']['title'];
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInputPlaceholders)->addData($input));
     }
 
     /**
@@ -492,6 +478,6 @@ class TcaInputPlaceholdersTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
         $GLOBALS['LANG'] = $languageService->reveal();
         $languageService->sL($labelString)->shouldBeCalled()->willReturn($localizedString);
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaInputPlaceholders)->addData($input));
     }
 }
index 865ad7a..58d715f 100644 (file)
@@ -22,23 +22,14 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaRadioItemsTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaRadioItems
-     */
-    protected $subject;
-
-    /**
      * @var array A backup of registered singleton instances
      */
     protected $singletonInstances = [];
@@ -46,7 +37,6 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     protected function setUp()
     {
         $this->singletonInstances = GeneralUtility::getSingletonInstances();
-        $this->subject = new TcaRadioItems();
     }
 
     protected function tearDown()
@@ -62,6 +52,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     public function addDataThrowsExceptionIfRadioItemsNotDefined()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -72,9 +63,14 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
             ],
         ];
+
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1438594829);
-        $this->subject->addData($input);
+        (new TcaRadioItems)->addData($input);
     }
 
     /**
@@ -83,6 +79,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     public function addDataKeepExistingItems()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -104,7 +101,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $languageService->sL(Argument::cetera())->willReturnArgument(0);
 
         $expected = $input;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRadioItems)->addData($input));
     }
 
     /**
@@ -113,6 +110,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     public function addDataThrowsExceptionIfItemsAreNoArray()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -126,9 +124,14 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
             ],
         ];
+
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1438607163);
-        $this->subject->addData($input);
+        (new TcaRadioItems)->addData($input);
     }
 
     /**
@@ -137,6 +140,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     public function addDataThrowsExceptionIfItemLabelIsNotSet()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -152,9 +156,14 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
             ],
         ];
+
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1438607164);
-        $this->subject->addData($input);
+        (new TcaRadioItems)->addData($input);
     }
 
     /**
@@ -163,6 +172,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     public function addDataThrowsExceptionIfItemValueIsNotSet()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -178,9 +188,14 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
             ],
         ];
+
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1438607165);
-        $this->subject->addData($input);
+        (new TcaRadioItems)->addData($input);
     }
 
     /**
@@ -189,6 +204,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     public function addDataTranslatesItemLabels()
     {
         $input = [
+            'tableName' => 'aTable',
             'processedTca' => [
                 'columns' => [
                     'aField' => [
@@ -215,8 +231,8 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $expected = $input;
         $expected['processedTca']['columns']['aField']['config']['items'][0][0] = 'translated';
 
-        $this->assertSame($expected, $this->subject->addData($input));
-        $this->subject->addData($input);
+        $this->assertSame($expected, (new TcaRadioItems)->addData($input));
+        (new TcaRadioItems)->addData($input);
     }
 
     /**
@@ -243,6 +259,11 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
             ],
         ];
+
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $expected = $input;
         $expected['processedTca']['columns']['aField']['config'] = [
             'type' => 'radio',
@@ -250,7 +271,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 'foo' => 'bar',
             ],
         ];
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRadioItems)->addData($input));
     }
 
     /**
@@ -319,7 +340,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         // itemsProcFunc must NOT have raised an exception
         $flashMessageQueue->enqueue($flashMessage)->shouldNotBeCalled();
 
-        $this->subject->addData($input);
+        (new TcaRadioItems)->addData($input);
     }
 
     /**
@@ -378,7 +399,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $flashMessageQueue->enqueue($flashMessage)->shouldBeCalled();
 
-        $this->subject->addData($input);
+        (new TcaRadioItems)->addData($input);
     }
 
     /**
@@ -426,7 +447,7 @@ class TcaRadioItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $expected = $input;
         $expected['processedTca']['columns']['aField']['config']['items'][0][0] = 'labelOverride';
 
-        $this->assertSame($expected, $this->subject->addData($input));
-        $this->subject->addData($input);
+        $this->assertSame($expected, (new TcaRadioItems)->addData($input));
+        (new TcaRadioItems)->addData($input);
     }
 }
index 48a3aa7..47df49c 100644 (file)
@@ -18,30 +18,20 @@ use Prophecy\Argument;
 use Prophecy\Prophecy\ObjectProphecy;
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaRecordTitle;
 use TYPO3\CMS\Core\Localization\LanguageService;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaRecordTitleTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaRecordTitle
-     */
-    protected $subject;
-
-    /**
      * @var string
      */
     protected $timeZone;
 
     public function setUp()
     {
-        $this->subject = new TcaRecordTitle();
         $this->timeZone = date_default_timezone_get();
         date_default_timezone_set('UTC');
     }
@@ -66,7 +56,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         ];
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1443706103);
-        $this->subject->addData($input);
+        (new TcaRecordTitle)->addData($input);
     }
 
     /**
@@ -77,6 +67,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $input = [
             'tableName' => 'aTable',
             'databaseRow' => [],
+            'isInlineChild' => false,
             'processedTca' => [
                 'ctrl' => [
                     'label' => 'uid',
@@ -91,7 +82,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $expected = $input;
         $expected['recordTitle'] = 'Test';
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -101,8 +92,14 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
-            'databaseRow' => [],
+            'databaseRow' => [
+                'uid' => 5,
+            ],
             'isInlineChild' => true,
+            'isOnSymmetricSide' => false,
+            'inlineParentConfig' => [
+                'foreign_label' => 'aField',
+            ],
             'processedTca' => [
                 'ctrl' => [
                     'label' => 'uid',
@@ -117,7 +114,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $expected = $input;
         $expected['recordTitle'] = 'Test';
 
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -146,13 +143,14 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
             ],
             'isInlineChild' => true,
+            'isOnSymmetricSide' => false,
             'inlineParentConfig' => [
                 'foreign_label' => 'aField',
             ],
         ];
         $expected = $input;
         $expected['recordTitle'] = 'aValue';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -163,6 +161,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $input = [
             'tableName' => 'aTable',
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => 'aValue',
             ],
             'processedTca' => [
@@ -181,13 +180,14 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
             ],
             'isInlineChild' => true,
+            'isOnSymmetricSide' => false,
             'inlineParentConfig' => [
                 'foreign_label' => 'aField',
             ],
         ];
         $expected = $input;
         $expected['recordTitle'] = 'aFormattedLabel';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -220,7 +220,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         ];
         $expected = $input;
         $expected['recordTitle'] = 'aValue';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -230,6 +230,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => 'NEW56017ee37d10e587251374',
             ],
@@ -248,7 +249,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'NEW56017ee37d10e587251374';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -370,6 +371,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => $fieldValue,
@@ -396,7 +398,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = $expectedTitle;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -406,6 +408,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => '',
@@ -433,7 +436,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'anotherValue';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -443,6 +446,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => '',
@@ -476,7 +480,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'additionalValue';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -486,6 +490,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => 'aField',
@@ -514,7 +519,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'aField, anotherField';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -524,6 +529,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => 'aField',
@@ -558,7 +564,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'aField, anotherField, additionalValue';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -568,6 +574,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => 'aField',
@@ -602,7 +609,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'aField, additionalValue';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -612,6 +619,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => '2',
@@ -637,7 +645,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'bar';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -647,6 +655,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => '2',
@@ -673,7 +682,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'foo';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -784,6 +793,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => $fieldValue,
@@ -812,7 +822,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = $expectedTitle;
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -822,6 +832,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'uid' => '1',
                 'aField' => [
@@ -855,7 +866,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'aValue, anotherValue';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -865,6 +876,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'aField' => 1,
             ],
@@ -889,7 +901,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:yes';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -899,6 +911,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'aField' => '5'
             ],
@@ -921,9 +934,14 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ]
         ];
 
+        /** @var LanguageService|ObjectProphecy $languageService */
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $expected = $input;
         $expected['recordTitle'] = 'foo, baz';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -933,6 +951,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'aField' => [
                     'data' => [
@@ -980,7 +999,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = '';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -990,6 +1009,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'aField' => [
                     '1',
@@ -1017,7 +1037,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'foo, bar';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 
     /**
@@ -1027,6 +1047,7 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         $input = [
             'tableName' => 'aTable',
+            'isInlineChild' => false,
             'databaseRow' => [
                 'aField' => '<p> text </p>',
             ],
@@ -1046,6 +1067,6 @@ class TcaRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $expected = $input;
         $expected['recordTitle'] = 'text';
-        $this->assertSame($expected, $this->subject->addData($input));
+        $this->assertSame($expected, (new TcaRecordTitle)->addData($input));
     }
 }
index c60a742..4f89c15 100644 (file)
@@ -24,30 +24,22 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder;
 use TYPO3\CMS\Core\Database\Query\QueryBuilder;
 use TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer;
+use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider;
 use TYPO3\CMS\Core\Tree\TableConfiguration\TableConfigurationTree;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Tests for the TcaSelectTreeItems provider.
  *
- * This test only covers the renderTree() method. All other methods are covered TcaSelecItemsTest
+ * This test only covers the renderTree() method. All other methods are covered by TcaSelectItemsTest
  *
  * @see TcaSelecItemsTest
  */
-class TcaSelectTreeItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class TcaSelectTreeItemsTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @var TcaSelectTreeItems
-     */
-    protected $subject;
-
-    /**
      * @var array A backup of registered singleton instances
      */
     protected $singletonInstances = [];
@@ -58,7 +50,6 @@ class TcaSelectTreeItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC
     public function setUp()
     {
         $this->singletonInstances = GeneralUtility::getSingletonInstances();
-        $this->subject = new TcaSelectTreeItems();
     }
 
     protected function tearDown()
@@ -145,6 +136,10 @@ class TcaSelectTreeItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC
         $GLOBALS['BE_USER'] = $backendUserProphecy->reveal();
         $backendUserProphecy->getPagePermsClause(Argument::cetera())->willReturn(' 1=1');
 
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $this->mockDatabaseConnection();
 
         /** @var  DatabaseTreeDataProvider|ObjectProphecy $treeDataProviderProphecy */
@@ -160,7 +155,9 @@ class TcaSelectTreeItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC
 
         $input = [
             'tableName' => 'aTable',
+            'effectivePid' => 42,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => '1'
             ],
             'processedTca' => [
@@ -187,7 +184,7 @@ class TcaSelectTreeItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC
         $expected['processedTca']['columns']['aField']['config']['items'] = [
             'fake', 'tree', 'data',
         ];
-        $this->assertEquals($expected, $this->subject->addData($input));
+        $this->assertEquals($expected, (new TcaSelectTreeItems)->addData($input));
     }
 
     /**
@@ -202,6 +199,10 @@ class TcaSelectTreeItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC
         $GLOBALS['BE_USER'] = $backendUserProphecy->reveal();
         $backendUserProphecy->getPagePermsClause(Argument::cetera())->willReturn(' 1=1');
 
+        $languageService = $this->prophesize(LanguageService::class);
+        $GLOBALS['LANG'] = $languageService->reveal();
+        $languageService->sL(Argument::cetera())->willReturnArgument(0);
+
         $this->mockDatabaseConnection();
 
         /** @var DatabaseTreeDataProvider|ObjectProphecy $treeDataProviderProphecy */
@@ -217,7 +218,9 @@ class TcaSelectTreeItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC
 
         $input = [
             'tableName' => 'aTable',
+            'effectivePid' => 42,
             'databaseRow' => [
+                'uid' => 5,
                 'aField' => '1'
             ],
             'processedTca' => [
@@ -257,7 +260,7 @@ class TcaSelectTreeItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC
             'selectTreeCompileItems' => true,
         ];
 
-        $this->subject->addData($input);
+        (new TcaSelectTreeItems)->addData($input);
 
         $treeDataProviderProphecy->setRootUid(42)->shouldHaveBeenCalled();
         $treeDataProviderProphecy->setExpandAll(true)->shouldHaveBeenCalled();
index 7d6e2bf..08e5425 100644 (file)
@@ -14,27 +14,27 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Backend\Form\Element;
+use TYPO3\CMS\Backend\Form\Element\SelectSingleElement;
+use TYPO3\CMS\Backend\Form\Element\SelectTreeElement;
+use TYPO3\CMS\Backend\Form\Element\UnknownElement;
+use TYPO3\CMS\Backend\Form\Exception;
 use TYPO3\CMS\Backend\Form\NodeFactory;
 use TYPO3\CMS\Backend\Form\NodeInterface;
 use TYPO3\CMS\Backend\Form\NodeResolverInterface;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class NodeFactoryTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @test
      */
     public function constructThrowsExceptionIfOverrideMissesNodeNameKey()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1432207533);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = [
             1433089391 => [
@@ -50,7 +50,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructThrowsExceptionIfOverrideMissesPriorityKey()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1432207533);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = [
             1433089393 => [
@@ -66,7 +66,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructThrowsExceptionIfOverrideMissesClassKey()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1432207533);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = [
             1433089392 => [
@@ -82,7 +82,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructThrowsExceptionIfOverridePriorityIsLowerThanZero()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1432223531);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = [
             1433089394 => [
@@ -98,7 +98,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructThrowsExceptionIfOverridePriorityIsHigherThanHundred()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1432223531);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = [
             1433089395 => [
@@ -115,7 +115,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructorThrowsExceptionIfOverrideTwoNodesWithSamePriorityAndSameNodeNameAreRegistered()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1432223893);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'] = [
             1433089396 => [
@@ -137,7 +137,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructThrowsExceptionIfResolverMissesNodeNameKey()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1433155522);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = [
             1433154905 => [
@@ -153,7 +153,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructThrowsExceptionIfResolverMissesPriorityKey()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1433155522);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = [
             1433154905 => [
@@ -169,7 +169,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructThrowsExceptionIfResolverMissesClassKey()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1433155522);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = [
             1433154906 => [
@@ -185,7 +185,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructThrowsExceptionIfResolverPriorityIsLowerThanZero()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1433155563);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = [
             1433154907 => [
@@ -201,7 +201,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructThrowsExceptionIfResolverPriorityIsHigherThanHundred()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1433155563);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = [
             1433154908 => [
@@ -218,7 +218,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function constructorThrowsExceptionIfResolverTwoNodesWithSamePriorityAndSameNodeNameAreRegistered()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1433155705);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = [
             1433154909 => [
@@ -260,7 +260,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function createThrowsExceptionIfRenderTypeIsNotGiven()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1431452406);
         $subject = new NodeFactory();
         $subject->create([]);
@@ -271,7 +271,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function createThrowsExceptionIfNodeDoesNotImplementNodeInterface()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1431872546);
         $mockNode = new \stdClass();
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
@@ -288,8 +288,11 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function createReturnsInstanceOfUnknownElementIfTypeIsNotRegistered()
     {
+        $unknownElementProphecy = $this->prophesize(UnknownElement::class);
+        $unknownElementRevelation = $unknownElementProphecy->reveal();
+        GeneralUtility::addInstance(UnknownElement::class, $unknownElementRevelation);
         $subject = new NodeFactory();
-        $this->assertInstanceOf(Element\UnknownElement::class, $subject->create(['renderType' => 'foo']));
+        $this->assertSame($unknownElementRevelation, $subject->create(['renderType' => 'foo']));
     }
 
     /**
@@ -301,8 +304,11 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'type' => 'select',
             'renderType' => 'selectTree',
         ];
+        $selectTreeElementProphecy = $this->prophesize(SelectTreeElement::class);
+        $selectTreeElementRevelation = $selectTreeElementProphecy->reveal();
+        GeneralUtility::addInstance(SelectTreeElement::class, $selectTreeElementRevelation);
         $subject = new NodeFactory();
-        $this->assertInstanceOf(Element\SelectTreeElement::class, $subject->create($data));
+        $this->assertSame($selectTreeElementRevelation, $subject->create($data));
     }
 
     /**
@@ -320,7 +326,10 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ],
         ];
         $subject = new NodeFactory();
-        $this->assertInstanceOf(Element\SelectSingleElement::class, $subject->create($data));
+        $selectSingleElementProphecy = $this->prophesize(SelectSingleElement::class);
+        $selectSingleElementRevelation = $selectSingleElementProphecy->reveal();
+        GeneralUtility::addInstance(SelectSingleElement::class, $selectSingleElementRevelation);
+        $this->assertSame($selectSingleElementRevelation, $subject->create($data));
     }
 
     /**
@@ -404,7 +413,7 @@ class NodeFactoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function createThrowsExceptionIfResolverDoesNotImplementNodeResolverInterface()
     {
-        $this->expectException(\TYPO3\CMS\Backend\Form\Exception::class);
+        $this->expectException(Exception::class);
         $this->expectExceptionCode(1433157422);
         $data = ['renderType' => 'foo'];
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = [
index b2632ae..7537bc5 100644 (file)
@@ -404,8 +404,8 @@ class RelationHandler
                 if (MathUtility::canBeInterpretedAsInteger($theID)) {
                     // Get the table name: If a part of the exploded string, use that.
                     // Otherwise if the id number is LESS than zero, use the second table, otherwise the first table
-                    $theTable = trim($parts[1])
-                        ? strrev(trim($parts[1]))
+                    $theTable = trim($parts[1] ?? '')
+                        ? strrev(trim($parts[1] ?? ''))
                         : ($this->secondTable && $theID < 0 ? $this->secondTable : $this->firstTable);
                     // If the ID is not blank and the table name is among the names in the inputted tableList
                     if (
index e42165f..be664ed 100644 (file)
@@ -62,7 +62,7 @@ class TreeDataProviderFactory
             if (isset($tcaConfiguration['foreign_label'])) {
                 $dataProvider->setLabelField($tcaConfiguration['foreign_label']);
             } else {
-                $dataProvider->setLabelField($GLOBALS['TCA'][$tableName]['ctrl']['label']);
+                $dataProvider->setLabelField($GLOBALS['TCA'][$tableName]['ctrl']['label'] ?? '');
             }
             $dataProvider->setTreeId(md5($table . '|' . $field));