Added test #11846: Add unit tests for t3lib_div::removeDotsFromTS()
authorOliver Hader <oliver.hader@typo3.org>
Tue, 1 Sep 2009 17:38:43 +0000 (17:38 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 1 Sep 2009 17:38:43 +0000 (17:38 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5872 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
tests/t3lib/t3lib_div_testcase.php

index efd5cc0..f113e90 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
        * Follow-up to feature #10724: Added unit tests for isValidUrl() and isOnCurrentHost() in t3lib_div (thanks to Marcus Krause)
        * Fixed bug #11845: Typo in a CLI error mesage: suue -> sure (thanks to Oliver Klee)
        * Fixed bug #11844: Description in about module uses htmlspecialchars which is wrong (thanks to Georg Ringer)
+       * Added test #11846: Add unit tests for t3lib_div::removeDotsFromTS()
 
 2009-09-01  Sebastian Kurfuerst  <sebastian@typo3.org>
 
index 6adc7d5..cc54426 100644 (file)
@@ -309,6 +309,93 @@ class t3lib_div_testcase extends tx_phpunit_testcase {
                $testUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL');
                $this->assertTrue(t3lib_div::isOnCurrentHost($testUrl));
        }
+
+       /**
+        * Tests whether removeDotsFromTS() behaves correctly.
+        * @test
+        * @see t3lib_div::removeDotsFromTS()
+        */
+       public function doesRemoveDotsFromTypoScriptSucceed() {
+               $typoScript = array(
+                       'propertyA.' => array(
+                               'keyA.' => array(
+                                       'valueA' => 1,
+                               ),
+                               'keyB' => 2,
+                       ),
+                       'propertyB' => 3,
+               );
+
+               $expectedResult = array(
+                       'propertyA' => array(
+                               'keyA' => array(
+                                       'valueA' => 1,
+                               ),
+                               'keyB' => 2,
+                       ),
+                       'propertyB' => 3,
+               );
+
+               $this->assertEquals($expectedResult, t3lib_div::removeDotsFromTS($typoScript));
+       }
+
+       /**
+        * Tests whether removeDotsFromTS() behaves correctly.
+        * @test
+        * @see t3lib_div::removeDotsFromTS()
+        */
+       public function doesRemoveDotsFromTypoScriptCorrectlyOverridesWithArray() {
+               $typoScript = array(
+                       'propertyA.' => array(
+                               'keyA' => 'getsOverridden',
+                               'keyA.' => array(
+                                       'valueA' => 1,
+                               ),
+                               'keyB' => 2,
+                       ),
+                       'propertyB' => 3,
+               );
+
+               $expectedResult = array(
+                       'propertyA' => array(
+                               'keyA' => array(
+                                       'valueA' => 1,
+                               ),
+                               'keyB' => 2,
+                       ),
+                       'propertyB' => 3,
+               );
+
+               $this->assertEquals($expectedResult, t3lib_div::removeDotsFromTS($typoScript));
+       }
+
+       /**
+        * Tests whether removeDotsFromTS() behaves correctly.
+        * @test
+        * @see t3lib_div::removeDotsFromTS()
+        */
+       public function doesRemoveDotsFromTypoScriptCorrectlyOverridesWithScalar() {
+               $typoScript = array(
+                       'propertyA.' => array(
+                               'keyA.' => array(
+                                       'valueA' => 1,
+                               ),
+                               'keyA' => 'willOverride',
+                               'keyB' => 2,
+                       ),
+                       'propertyB' => 3,
+               );
+
+               $expectedResult = array(
+                       'propertyA' => array(
+                               'keyA' => 'willOverride',
+                               'keyB' => 2,
+                       ),
+                       'propertyB' => 3,
+               );
+
+               $this->assertEquals($expectedResult, t3lib_div::removeDotsFromTS($typoScript));
+       }
 }
 
 ?>
\ No newline at end of file