[TASK] Add unit tests for stdWrap_case() 71/43771/2
authorMichael Oehlhof <typo3@oehlhof.de>
Sun, 4 Oct 2015 00:40:24 +0000 (02:40 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 4 Oct 2015 12:05:52 +0000 (14:05 +0200)
Resolves: #70333
Releases: master
Change-Id: Iabc6caa7ec9d47aff7ac37634bf1abb0213e7ed7
Reviewed-on: http://review.typo3.org/43771
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php

index 854d121..ec2a5da 100644 (file)
@@ -1922,6 +1922,77 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        }
 
        /**
+        * Data provider for stdWrap_case test
+        *
+        * @return array
+        */
+       public function stdWrap_caseDataProvider() {
+               return array(
+                       'lower case text to upper' => array(
+                               '<span>text</span>',
+                               array(
+                                       'case' => 'upper',
+                               ),
+                               '<span>TEXT</span>',
+                       ),
+                       'upper case text to lower' => array(
+                               '<span>TEXT</span>',
+                               array(
+                                       'case' => 'lower',
+                               ),
+                               '<span>text</span>',
+                       ),
+                       'capitalize text' => array(
+                               '<span>this is a text</span>',
+                               array(
+                                       'case' => 'capitalize',
+                               ),
+                               '<span>This Is A Text</span>',
+                       ),
+                       'ucfirst text' => array(
+                               '<span>this is a text</span>',
+                               array(
+                                       'case' => 'ucfirst',
+                               ),
+                               '<span>This is a text</span>',
+                       ),
+                       'lcfirst text' => array(
+                               '<span>This is a Text</span>',
+                               array(
+                                       'case' => 'lcfirst',
+                               ),
+                               '<span>this is a Text</span>',
+                       ),
+                       'uppercamelcase text' => array(
+                               '<span>this_is_a_text</span>',
+                               array(
+                                       'case' => 'uppercamelcase',
+                               ),
+                               '<span>ThisIsAText</span>',
+                       ),
+                       'lowercamelcase text' => array(
+                               '<span>this_is_a_text</span>',
+                               array(
+                                       'case' => 'lowercamelcase',
+                               ),
+                               '<span>thisIsAText</span>',
+                       ),
+               );
+       }
+
+       /**
+        * @param string|NULL $content
+        * @param array $configuration
+        * @param string $expected
+        * @dataProvider stdWrap_caseDataProvider
+        * @test
+        */
+       public function stdWrap_case($content, array $configuration, $expected) {
+               $result = $this->subject->stdWrap_case($content, $configuration);
+               $this->assertEquals($expected, $result);
+       }
+
+       /**
         * Data provider for stdWrap_stdWrapValue test
         *
         * @return array