[BUGFIX] Followup to #54131 20/27220/2
authorFrans Saris <franssaris@gmail.com>
Fri, 31 Jan 2014 19:43:48 +0000 (20:43 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 6 Feb 2014 19:24:39 +0000 (20:24 +0100)
added unit tests.

This change adds the mocking to the new tests.

Resolves: #54131
Releases: 6.1, 6.2
Change-Id: I09abbcea6a2c6310b7a04774808aa92ab8ad1c86
Reviewed-on: https://review.typo3.org/27220
Reviewed-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php

index 8a4db2e..0810380 100644 (file)
@@ -478,6 +478,14 @@ class BackendUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                )
                        )
                );
+               // Stub LanguageService and let sL() return the same value that came in again
+               $GLOBALS['LANG'] = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
+               $GLOBALS['LANG']->expects($this->any())->method('sL')
+                       ->will($this->returnCallback(
+                               function($name) {
+                                       return $name;
+                               }
+                       ));
 
                $tcaBackup = $GLOBALS['TCA'][$table];
                unset($GLOBALS['TCA'][$table]);
@@ -505,6 +513,14 @@ class BackendUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                )
                        )
                );
+               // Stub LanguageService and let sL() return the same value that came in again
+               $GLOBALS['LANG'] = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
+               $GLOBALS['LANG']->expects($this->any())->method('sL')
+                       ->will($this->returnCallback(
+                               function($name) {
+                                       return $name;
+                               }
+                       ));
 
                $tcaBackup = $GLOBALS['TCA'][$table];
                unset($GLOBALS['TCA'][$table]);