[TASK] Deprecate further l10n_mode usages 13/52013/3
authorOliver Hader <oliver@typo3.org>
Sun, 12 Mar 2017 15:23:24 +0000 (16:23 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Mon, 20 Mar 2017 09:16:37 +0000 (10:16 +0100)
This change is focussed on runtime processing of l10n_mode
which is not required anymore. Thus accordant internal
functionality is deprecated.

Change-Id: I19b8eabdfc98bfe83ff80d8205b0c9f029330ed5
Resolves: #80345
Releases: master
Reviewed-on: https://review.typo3.org/52013
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php

index 001d989..f52a406 100644 (file)
@@ -2082,9 +2082,11 @@ class BackendUtility
      * @param string $table Table name
      * @param array $row Row to fill with original language values
      * @return array Row with values from the original language
+     * @deprecated since TYPO3 CMS 8, will be removed in TYPO3 CMS 9
      */
     protected static function replaceL10nModeFields($table, array $row)
     {
+        GeneralUtility::logDeprecatedFunction();
         $originalUidField = isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'])
             ? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']
             : '';
@@ -2131,10 +2133,6 @@ class BackendUtility
                 GeneralUtility::callUserFunction($GLOBALS['TCA'][$table]['ctrl']['label_userFunc'], $params, $null);
                 $recordTitle = $params['title'];
             } else {
-                if (is_array($row)) {
-                    $row = self::replaceL10nModeFields($table, $row);
-                }
-
                 // No userFunc: Build label
                 $recordTitle = self::getProcessedValue(
                     $table,
index 25ca894..cadd2d0 100644 (file)
@@ -905,93 +905,6 @@ class BackendUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     }
 
     /**
-     * Data provider for replaceL10nModeFieldsReplacesFields
-     *
-     * @return array
-     */
-    public function replaceL10nModeFieldsReplacesFieldsDataProvider()
-    {
-        return [
-            'same table: exclude' => [
-                'foo',
-                [
-                    'origUid' => 1,
-                    'field2' => 'fdas',
-                    'field3' => 'trans',
-                ],
-                [
-                    'foo' => [
-                        'ctrl' => [
-                            'transOrigPointerField' => 'origUid'
-                        ],
-                        'columns' => [
-                            'field2' => ['l10n_mode' => 'exclude'],
-                            'field3' => ['l10n_mode' => 'exclude']
-                        ]
-                    ]
-                ],
-                [
-                    'origUid' => 0,
-                    'field2' => 'basic',
-                    'field3' => '',
-                ],
-                [
-                    'origUid' => 1,
-                    'field2' => 'basic',
-                    'field3' => '',
-                ]
-            ],
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider replaceL10nModeFieldsReplacesFieldsDataProvider
-     *
-     * @param string $table
-     * @param array $row
-     * @param array $tca
-     * @param array $originalRow
-     * @param array $expected
-     *
-     * @throws \InvalidArgumentException
-     * @throws \PHPUnit_Framework_Exception
-     */
-    public function replaceL10nModeFieldsReplacesFields($table, array $row, array $tca, array $originalRow, $expected)
-    {
-        $tableName = $table === 'pages_language_overlay' ? 'pages' : $table;
-
-        list($queryBuilderProphet, $connectionPoolProphet) = $this->mockDatabaseConnection($tableName);
-
-        $statementProphet = $this->prophesize(\Doctrine\DBAL\Driver\Statement::class);
-        $statementProphet->fetch()->willReturn($originalRow, false);
-
-        $queryBuilderProphet->select('*')
-            ->shouldBeCalled()
-            ->willReturn($queryBuilderProphet->reveal());
-        $queryBuilderProphet->from($tableName)
-            ->shouldBeCalled()
-            ->willReturn($queryBuilderProphet->reveal());
-        $queryBuilderProphet->where('`uid` = 1')
-            ->shouldBeCalled()
-            ->willReturn($queryBuilderProphet->reveal());
-        $queryBuilderProphet->createNamedParameter(Argument::cetera())
-            ->shouldBeCalled()
-            ->willReturnArgument(0);
-        $queryBuilderProphet->execute()
-            ->shouldBeCalled()
-            ->willReturn($statementProphet->reveal());
-
-        GeneralUtility::addInstance(ConnectionPool::class, $connectionPoolProphet->reveal());
-
-        $GLOBALS['TCA'] = $tca;
-
-        /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|BackendUtility $subject */
-        $subject = $this->getAccessibleMock(BackendUtility::class, ['dummy']);
-        $this->assertSame($expected, $subject->_call('replaceL10nModeFields', $table, $row));
-    }
-
-    /**
      * @test
      */
     public function getSpecConfPartsSplitsDefaultExtras()