[!!!][TASK] Set f:format.date format to system default
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Tests / Unit / ViewHelpers / Format / DateViewHelperTest.php
index 0ee31a2..f721f1f 100644 (file)
@@ -33,6 +33,7 @@ class DateViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        'LC_TIME' => setlocale(LC_TIME, 0),
                );
                $this->timezone = @date_default_timezone_get();
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] = 'Y-m-d';
        }
 
        public function tearDown() {
@@ -79,6 +80,26 @@ class DateViewHelperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $this->assertEquals('', $actualResult);
        }
 
+       /**
+        * @test
+        */
+       public function viewHelperUsesDefaultIfNoSystemFormatIsAvailable() {
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] = '';
+               $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\Format\DateViewHelper();
+               $actualResult = $viewHelper->render('@1391876733');
+               $this->assertEquals('2014-02-08', $actualResult);
+       }
+
+       /**
+        * @test
+        */
+       public function viewHelperUsesSystemFormat() {
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] = 'l, j. M y';
+               $viewHelper = new \TYPO3\CMS\Fluid\ViewHelpers\Format\DateViewHelper();
+               $actualResult = $viewHelper->render('@1391876733');
+               $this->assertEquals('Saturday, 8. Feb 14', $actualResult);
+       }
+
        /**
         * @test
         * @expectedException \TYPO3\CMS\Fluid\Core\ViewHelper\Exception