[BUGFIX] Follow-up to l10n_mode=exclude for record titles 92/29492/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 15 Apr 2014 19:47:01 +0000 (21:47 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 15 Apr 2014 20:46:09 +0000 (22:46 +0200)
Fix a possible warning in the new method and simplify test
cases a bit.

Change-Id: Ie9ee3c1b52d3a692c23428f21e3fb7311da9cb2a
Resolves: #33499
Releases: 6.2
Reviewed-on: https://review.typo3.org/29492
Reviewed-by: Andreas Wolf
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php

index 9b9c694..b234c56 100644 (file)
@@ -1928,7 +1928,9 @@ class BackendUtility {
                                GeneralUtility::callUserFunction($GLOBALS['TCA'][$table]['ctrl']['label_userFunc'], $params, $null);
                                $t = $params['title'];
                        } else {
-                               $row = self::replaceL10nModeFields($table, $row);
+                               if (is_array($row)) {
+                                       $row = self::replaceL10nModeFields($table, $row);
+                               }
 
                                // No userFunc: Build label
                                $t = self::getProcessedValue($table, $GLOBALS['TCA'][$table]['ctrl']['label'], $row[$GLOBALS['TCA'][$table]['ctrl']['label']], 0, 0, FALSE, $row['uid'], $forceResult);
index 98c62e6..bbf90d2 100644 (file)
@@ -1275,17 +1275,12 @@ class BackendUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @dataProvider replaceL10nModeFieldsReplacesFieldsDataProvider
         */
        public function replaceL10nModeFieldsReplacesFields($table, $row, $tca, $originalRow, $expected) {
-               $backupTCA = $GLOBALS['TCA'];
-               $backupDB = $GLOBALS['TYPO3_DB'];
                $GLOBALS['TCA'] = $tca;
                $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection');
                $GLOBALS['TYPO3_DB']->expects($this->any())->method('sql_fetch_assoc')->will($this->returnValue($originalRow));
 
-               /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\TYPO3\CMS\Backend\Utility\BackendUtility $fixture */
-               $fixture = $this->getAccessibleMock('TYPO3\\CMS\\Backend\\Utility\\BackendUtility', array('dummy'));
-               $this->assertSame($expected, $fixture->_call('replaceL10nModeFields', $table, $row));
-
-               $GLOBALS['TCA'] = $backupTCA;
-               $GLOBALS['TYPO3_DB'] = $backupDB;
+               /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\TYPO3\CMS\Backend\Utility\BackendUtility $subject */
+               $subject = $this->getAccessibleMock('TYPO3\\CMS\\Backend\\Utility\\BackendUtility', array('dummy'));
+               $this->assertSame($expected, $subject->_call('replaceL10nModeFields', $table, $row));
        }
 }