Added feature #9876: Provide $severity in t3lib_div::sysLog() Hook (Thanks to Michael...
[Packages/TYPO3.CMS.git] / tests / regularexpression_testcase.php
index 8260551..831fc93 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 * Copyright notice
 *
-* (c) 2009 Steffen Kamper <info@sk-typo3.de> 
+* (c) 2009 Steffen Kamper <info@sk-typo3.de>
 * All rights reserved
 *
 * This script is part of the TYPO3 project. The TYPO3 project is
 * This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 
-
-
 /**
- * Testcase for comparing regular expressions in the TYPO3 core, eg while replacing ereg* to preg*
+ * Testcase for comparing regular expressions in the TYPO3 core, eg. while
+ * replacing ereg* to preg*.
  *
  * @package TYPO3
  * @subpackage t3lib
  * @author Steffen Kamper <info@sk-typo3.de>
  */
 class regularexpression_testcase extends tx_phpunit_testcase {
-       
-
        public function setUp() {
-               
        }
 
        public function tearDown() {
-               
        }
 
 
-       //////////////////////
-       // Utility functions
-       //////////////////////
-
-       
-
-
-       ////////////////////////////////////
+       //////////////////////////////////
        // Tests for regular expressions
-       ////////////////////////////////////
-
-       public function testRemoveLineFeeds() {
-           $thisLine = 'test
-           test
-           test';      
-           $test = (ereg_replace("[\n\r]*", '', $thisLine) == preg_replace('/[\n\r]*/', '', $thisLine));
+       //////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function removeLineFeeds() {
+               $thisLine = 'test
+               test
+               test';
+               $test = (ereg_replace("[\n\r]*", '', $thisLine) == preg_replace('/[\n\r]*/', '', $thisLine));
                $this->assertTrue(
                        $test
                );
        }
 
-       public function testRemoveNoneAscii() {
+       /**
+        * @test
+        */
+       public function removeNoneAscii() {
                $string = 'this is a teststring with Umlauts äöü';
-           $test = (substr(ereg_replace('[^a-zA-Z0-9_]','',str_replace(' ','_',trim($string))),0,30) == substr(preg_replace('/[^a-zA-Z0-9_]/', '', str_replace(' ', '_', trim($string))), 0, 30));
+               $test = (substr(ereg_replace('[^a-zA-Z0-9_]','',str_replace(' ','_',trim($string))),0,30) == substr(preg_replace('/[^a-zA-Z0-9_]/', '', str_replace(' ', '_', trim($string))), 0, 30));
                $this->assertTrue(
                        $test
                );
        }
 
-       public function testClearPath() {
+       /**
+        * @test
+        */
+       public function clearPath() {
                $string = './thisDir/subDir/';
-           $test = (ereg_replace('^\./', '', $string) == preg_replace('/^\.\//', '', $string));
+               $test = (ereg_replace('^\./', '', $string) == preg_replace('/^\.\//', '', $string));
                $this->assertTrue(
                        $test
                );
        }
 
-       public function testRemoveTrailingSign() {
+       /**
+        * @test
+        */
+       public function removeTrailingSign() {
                $string = 'label:';
-           $test = (ereg_replace(':$', '', $string) == preg_replace('/:$/', '', $string));
+               $test = (ereg_replace(':$', '', $string) == preg_replace('/:$/', '', $string));
                $this->assertTrue(
                        $test
                );
        }
 
-       
-       
-       public function testSplit1() {
+
+
+       /**
+        * @test
+        */
+       public function split1() {
                $string = 'test1, test2|test3;test4';
                $array1 = split(',|;|'.chr(10),$string);
                $array2 = preg_split('/[,;'.chr(10).']/',$string);
@@ -102,7 +105,10 @@ class regularexpression_testcase extends tx_phpunit_testcase {
                }
        }
 
-       public function testSplit2() {
+       /**
+        * @test
+        */
+       public function split2() {
                $string = 'test1, test2=test3; test4';
                $array1 = split('[[:space:]=]',$string,2);
                $array2 = preg_split('/[[:space:]=]/',$string,2);
@@ -113,7 +119,10 @@ class regularexpression_testcase extends tx_phpunit_testcase {
                }
        }
 
-       public function testSplit3() {
+       /**
+        * @test
+        */
+       public function split3() {
                $string = 'test1:test2=test3; test4=test5|test6';
                $array1 = split('=|:',$string,3);
                $array2 = preg_split('/[=:]/',$string,3);
@@ -124,7 +133,10 @@ class regularexpression_testcase extends tx_phpunit_testcase {
                }
        }
 
-       public function testSplit4() {
+       /**
+        * @test
+        */
+       public function split4() {
                $string = 'key => value';
                $array1 = split("[[:space:]=>]",$string,2);
                $array2 = preg_split('/[[:space:]=>]/',$string,2);
@@ -135,7 +147,10 @@ class regularexpression_testcase extends tx_phpunit_testcase {
                }
        }
 
-       public function testSplit5() {
+       /**
+        * @test
+        */
+       public function split5() {
                $string = 'test[1][2][3][4] test[5] test[6]';
                $array1 = split('\[|\]',$string);
                $array2 = preg_split('/\[|\]/',$string);
@@ -145,7 +160,5 @@ class regularexpression_testcase extends tx_phpunit_testcase {
                        );
                }
        }
-
-       
 }
-?>
\ No newline at end of file
+?>