[TASK] Remove superfluous parenthesis in sysext frontend
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Tests / Unit / ContentObject / ContentObjectRendererTest.php
index 54afdd9..282c05b 100644 (file)
@@ -337,13 +337,13 @@ class ContentObjectRendererTest extends \tx_phpunit_testcase {
                                $charset . ' plain text; 11|...' => array(
                                        '11|...',
                                        $plainText,
-                                       ('Kasper Sk' . chr(229)) . 'r...',
+                                       'Kasper Sk' . chr(229) . 'r...',
                                        $charset
                                ),
                                $charset . ' plain text; -58|...' => array(
                                        '-58|...',
                                        $plainText,
-                                       ('...h' . chr(248)) . 'j implemented the original version of the crop function.',
+                                       '...h' . chr(248) . 'j implemented the original version of the crop function.',
                                        $charset
                                ),
                                $charset . ' plain text; 4|...|1' => array(
@@ -373,7 +373,7 @@ class ContentObjectRendererTest extends \tx_phpunit_testcase {
                                $charset . ' text with markup; 11|...' => array(
                                        '11|...',
                                        $textWithMarkup,
-                                       ('<strong><a href="mailto:kasper@typo3.org">Kasper Sk' . chr(229)) . 'r...</a></strong>',
+                                       '<strong><a href="mailto:kasper@typo3.org">Kasper Sk' . chr(229) . 'r...</a></strong>',
                                        $charset
                                ),
                                $charset . ' text with markup; 13|...' => array(
@@ -403,7 +403,7 @@ class ContentObjectRendererTest extends \tx_phpunit_testcase {
                                $charset . ' text with markup; -58|...' => array(
                                        '-58|...',
                                        $textWithMarkup,
-                                       ('<strong><a href="mailto:kasper@typo3.org">...h' . chr(248)) . 'j</a> implemented</strong> the original version of the crop function.',
+                                       '<strong><a href="mailto:kasper@typo3.org">...h' . chr(248) . 'j</a> implemented</strong> the original version of the crop function.',
                                        $charset
                                ),
                                $charset . ' text with markup 4|...|1' => array(
@@ -1029,6 +1029,56 @@ class ContentObjectRendererTest extends \tx_phpunit_testcase {
                }
        }
 
+       /**
+        * Data provider for the stdWrap_strftime test
+        *
+        * @return array multi-dimensional array with the second level like this:
+        * @see stdWrap_strftime
+        */
+       public function stdWrap_strftimeReturnsFormattedStringDataProvider() {
+               $data = array(
+                       'given timestamp' => array(
+                               1346500800, // This is 2012-09-01 12:00 in UTC/GMT
+                               array(
+                                       'strftime' => '%d-%m-%Y',
+                               ),
+                       ),
+                       'empty string' => array(
+                               '',
+                               array(
+                                       'strftime' => '%d-%m-%Y',
+                               ),
+                       ),
+                       'testing null' => array(
+                               NULL,
+                               array(
+                                       'strftime' => '%d-%m-%Y',
+                               ),
+                       ),
+               );
+               return $data;
+       }
+
+       /**
+        * @test
+        * @dataProvider stdWrap_strftimeReturnsFormattedStringDataProvider
+        */
+       public function stdWrap_strftimeReturnsFormattedString($content, $conf) {
+                       // Set exec_time to a hard timestamp (backed up by $this->backupGlobals = TRUE)
+               $GLOBALS['EXEC_TIME'] = 1346500800;
+                       // Save current timezone and set to UTC to make the system unter test behave
+                       // the same in all server timezone settings
+               $timezoneBackup = date_default_timezone_get();
+               date_default_timezone_set('UTC');
+
+               $result = $this->cObj->stdWrap_strftime($content, $conf);
+
+                       // Reset timezone
+               date_default_timezone_set($timezoneBackup);
+
+               $this->assertEquals('01-09-2012', $result);
+       }
+
 }
 
-?>
\ No newline at end of file
+?>