[TASK] Improve TranslateViewHelperTest 87/49287/4
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Mon, 1 Aug 2016 15:34:49 +0000 (17:34 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 1 Aug 2016 16:19:53 +0000 (18:19 +0200)
Use Fixture class instead original in order to prevent
static call to LocalizationUtility::translate().

Resolves: #77335
Relates: #77334
Releases: master
Change-Id: I588c3b73853186e654302783bfa9119b69d4484c
Reviewed-on: https://review.typo3.org/49287
Reviewed-by: Sebastian Bumann <bumann.sebastian@gmail.com>
Tested-by: Sebastian Bumann <bumann.sebastian@gmail.com>
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/fluid/Tests/Unit/ViewHelpers/TranslateViewHelperTest.php

index d8fc0ca..eddbe01 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures\TranslateViewHelperFixtureForEmptyString;
 use TYPO3\CMS\Fluid\ViewHelpers\TranslateViewHelper;
 
 /**
@@ -25,18 +26,14 @@ class TranslateViewHelperTest extends ViewHelperBaseTestcase
      */
     protected $viewHelper;
 
-    protected function setUp()
-    {
-        parent::setUp();
-        $this->viewHelper = new TranslateViewHelper();
-        $this->injectDependenciesIntoViewHelper($this->viewHelper);
-    }
-
     /**
      * @test
      */
     public function renderThrowsExceptionIfNoKeyOrIdParameterIsGiven()
     {
+        $this->viewHelper = new TranslateViewHelper();
+        $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
         $this->expectException(\TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException::class);
         $this->expectExceptionCode(1351584844);
 
@@ -52,6 +49,9 @@ class TranslateViewHelperTest extends ViewHelperBaseTestcase
      */
     public function renderReturnsStringForGivenKey()
     {
+        $this->viewHelper = new TranslateViewHelperFixtureForEmptyString();
+        $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
         $this->viewHelper->setRenderChildrenClosure(
             function () {
                 return '<p>hello world</p>';
@@ -72,6 +72,9 @@ class TranslateViewHelperTest extends ViewHelperBaseTestcase
      */
     public function renderReturnsStringForGivenId()
     {
+        $this->viewHelper = new TranslateViewHelperFixtureForEmptyString();
+        $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
         $this->viewHelper->setRenderChildrenClosure(
             function () {
                 return '<p>hello world</p>';
@@ -93,6 +96,9 @@ class TranslateViewHelperTest extends ViewHelperBaseTestcase
      */
     public function renderReturnsDefaultIfNoTranslationIsFound()
     {
+        $this->viewHelper = new TranslateViewHelperFixtureForEmptyString();
+        $this->injectDependenciesIntoViewHelper($this->viewHelper);
+
         $this->viewHelper->setRenderChildrenClosure(
             function () {
                 return 'default';