[TASK] Unit test to cover stdWrap_htmlSpecialChars 29/48529/2
authorElmar Hinz <t3elmar@gmail.com>
Thu, 9 Jun 2016 09:33:53 +0000 (11:33 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 9 Jun 2016 13:37:57 +0000 (15:37 +0200)
Resolves: #76553
Releases: master
Change-Id: I123fc4fbe6691b26e01151829e411436fe6af72d
Reviewed-on: https://review.typo3.org/48529
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php

index 84ff318..3bcc42c 100755 (executable)
@@ -2560,6 +2560,53 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     }
 
     /**
     }
 
     /**
+     * Data provider for stdWrap_htmlSpecialChars
+     *
+     * @return array Order: expected, input, conf
+     */
+    public function stdWrap_htmlSpecialCharsDataProvider()
+    {
+        return [
+            'void conf' => [
+                '&lt;span&gt;1 &amp;lt; 2&lt;/span&gt;',
+                '<span>1 &lt; 2</span>',
+                [],
+            ],
+            'void preserveEntities' => [
+                '&lt;span&gt;1 &amp;lt; 2&lt;/span&gt;',
+                '<span>1 &lt; 2</span>',
+                ['htmlSpecialChars.' => []],
+            ],
+            'false preserveEntities' => [
+                '&lt;span&gt;1 &amp;lt; 2&lt;/span&gt;',
+                '<span>1 &lt; 2</span>',
+                ['htmlSpecialChars.' => ['preserveEntities' => 0]],
+            ],
+            'true preserveEntities' => [
+                '&lt;span&gt;1 &lt; 2&lt;/span&gt;',
+                '<span>1 &lt; 2</span>',
+                ['htmlSpecialChars.' => ['preserveEntities' => 1]],
+            ],
+        ];
+    }
+
+    /**
+     * Check if brTag works properly
+     *
+     * @test
+     * @dataProvider stdWrap_htmlSpecialCharsDataProvider
+     * @param string $expected The expected value.
+     * @param string $input The input value.
+     * @param array $conf htmlSpecialChars.preserveEntities
+     * @return void
+     */
+    public function stdWrap_htmlSpecialChars($expected, $input, $conf)
+    {
+        $this->assertSame($expected,
+            $this->subject->stdWrap_htmlSpecialChars($input, $conf));
+    }
+
+    /**
      * Data provider for stdWrap_encodeForJavaScriptValue test
      *
      * @return array multi-dimensional array with the second level like this:
      * Data provider for stdWrap_encodeForJavaScriptValue test
      *
      * @return array multi-dimensional array with the second level like this: