Convert DOS to Unix linebreaks
authorMichael Stucki <michael.stucki@typo3.org>
Fri, 23 Jan 2009 14:57:18 +0000 (14:57 +0000)
committerMichael Stucki <michael.stucki@typo3.org>
Fri, 23 Jan 2009 14:57:18 +0000 (14:57 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4826 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/tests/regularexpression_testcase.php
typo3/tests/t3lib_tcemain_testcase.php

index 1f3f145..8260551 100644 (file)
-<?php\r
-/***************************************************************\r
-* Copyright notice\r
-*\r
-* (c) 2009 Steffen Kamper <info@sk-typo3.de> \r
-* All rights reserved\r
-*\r
-* This script is part of the TYPO3 project. The TYPO3 project is\r
-* free software; you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation; either version 2 of the License, or\r
-* (at your option) any later version.\r
-*\r
-* The GNU General Public License can be found at\r
-* http://www.gnu.org/copyleft/gpl.html.\r
-*\r
-* This script is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-* GNU General Public License for more details.\r
-*\r
-* This copyright notice MUST APPEAR in all copies of the script!\r
-***************************************************************/\r
-\r
-\r
-\r
-/**\r
- * Testcase for comparing regular expressions in the TYPO3 core, eg while replacing ereg* to preg*\r
- *\r
- * @package TYPO3\r
- * @subpackage t3lib\r
- *\r
- * @author Steffen Kamper <info@sk-typo3.de>\r
- */\r
-class regularexpression_testcase extends tx_phpunit_testcase {\r
-       \r
-\r
-       public function setUp() {\r
-               \r
-       }\r
-\r
-       public function tearDown() {\r
-               \r
-       }\r
-\r
-\r
-       //////////////////////\r
-       // Utility functions\r
-       //////////////////////\r
-\r
-       \r
-\r
-\r
-       ////////////////////////////////////\r
-       // Tests for regular expressions\r
-       ////////////////////////////////////\r
-\r
-       public function testRemoveLineFeeds() {\r
-           $thisLine = 'test\r
-           test\r
-           test';      \r
-           $test = (ereg_replace("[\n\r]*", '', $thisLine) == preg_replace('/[\n\r]*/', '', $thisLine));\r
-               $this->assertTrue(\r
-                       $test\r
-               );\r
-       }\r
-\r
-       public function testRemoveNoneAscii() {\r
-               $string = 'this is a teststring with Umlauts äöü';\r
-           $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));\r
-               $this->assertTrue(\r
-                       $test\r
-               );\r
-       }\r
-\r
-       public function testClearPath() {\r
-               $string = './thisDir/subDir/';\r
-           $test = (ereg_replace('^\./', '', $string) == preg_replace('/^\.\//', '', $string));\r
-               $this->assertTrue(\r
-                       $test\r
-               );\r
-       }\r
-\r
-       public function testRemoveTrailingSign() {\r
-               $string = 'label:';\r
-           $test = (ereg_replace(':$', '', $string) == preg_replace('/:$/', '', $string));\r
-               $this->assertTrue(\r
-                       $test\r
-               );\r
-       }\r
-\r
-       \r
-       \r
-       public function testSplit1() {\r
-               $string = 'test1, test2|test3;test4';\r
-               $array1 = split(',|;|'.chr(10),$string);\r
-               $array2 = preg_split('/[,;'.chr(10).']/',$string);\r
-               foreach($array1 as $key => $value) {\r
-                       $this->assertTrue(\r
-                               ($array2[$key] === $value)\r
-                       );\r
-               }\r
-       }\r
-\r
-       public function testSplit2() {\r
-               $string = 'test1, test2=test3; test4';\r
-               $array1 = split('[[:space:]=]',$string,2);\r
-               $array2 = preg_split('/[[:space:]=]/',$string,2);\r
-               foreach($array1 as $key => $value) {\r
-                       $this->assertTrue(\r
-                               ($array2[$key] === $value)\r
-                       );\r
-               }\r
-       }\r
-\r
-       public function testSplit3() {\r
-               $string = 'test1:test2=test3; test4=test5|test6';\r
-               $array1 = split('=|:',$string,3);\r
-               $array2 = preg_split('/[=:]/',$string,3);\r
-               foreach($array1 as $key => $value) {\r
-                       $this->assertTrue(\r
-                               ($array2[$key] === $value)\r
-                       );\r
-               }\r
-       }\r
-\r
-       public function testSplit4() {\r
-               $string = 'key => value';\r
-               $array1 = split("[[:space:]=>]",$string,2);\r
-               $array2 = preg_split('/[[:space:]=>]/',$string,2);\r
-               foreach($array1 as $key => $value) {\r
-                       $this->assertTrue(\r
-                               ($array2[$key] === $value)\r
-                       );\r
-               }\r
-       }\r
-\r
-       public function testSplit5() {\r
-               $string = 'test[1][2][3][4] test[5] test[6]';\r
-               $array1 = split('\[|\]',$string);\r
-               $array2 = preg_split('/\[|\]/',$string);\r
-               foreach($array1 as $key => $value) {\r
-                       $this->assertTrue(\r
-                               ($array2[$key] === $value)\r
-                       );\r
-               }\r
-       }\r
-\r
-       \r
-}\r
+<?php
+/***************************************************************
+* Copyright notice
+*
+* (c) 2009 Steffen Kamper <info@sk-typo3.de> 
+* All rights reserved
+*
+* This script is part of the TYPO3 project. The TYPO3 project is
+* free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* The GNU General Public License can be found at
+* http://www.gnu.org/copyleft/gpl.html.
+*
+* This script is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* 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*
+ *
+ * @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));
+               $this->assertTrue(
+                       $test
+               );
+       }
+
+       public function testRemoveNoneAscii() {
+               $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));
+               $this->assertTrue(
+                       $test
+               );
+       }
+
+       public function testClearPath() {
+               $string = './thisDir/subDir/';
+           $test = (ereg_replace('^\./', '', $string) == preg_replace('/^\.\//', '', $string));
+               $this->assertTrue(
+                       $test
+               );
+       }
+
+       public function testRemoveTrailingSign() {
+               $string = 'label:';
+           $test = (ereg_replace(':$', '', $string) == preg_replace('/:$/', '', $string));
+               $this->assertTrue(
+                       $test
+               );
+       }
+
+       
+       
+       public function testSplit1() {
+               $string = 'test1, test2|test3;test4';
+               $array1 = split(',|;|'.chr(10),$string);
+               $array2 = preg_split('/[,;'.chr(10).']/',$string);
+               foreach($array1 as $key => $value) {
+                       $this->assertTrue(
+                               ($array2[$key] === $value)
+                       );
+               }
+       }
+
+       public function testSplit2() {
+               $string = 'test1, test2=test3; test4';
+               $array1 = split('[[:space:]=]',$string,2);
+               $array2 = preg_split('/[[:space:]=]/',$string,2);
+               foreach($array1 as $key => $value) {
+                       $this->assertTrue(
+                               ($array2[$key] === $value)
+                       );
+               }
+       }
+
+       public function testSplit3() {
+               $string = 'test1:test2=test3; test4=test5|test6';
+               $array1 = split('=|:',$string,3);
+               $array2 = preg_split('/[=:]/',$string,3);
+               foreach($array1 as $key => $value) {
+                       $this->assertTrue(
+                               ($array2[$key] === $value)
+                       );
+               }
+       }
+
+       public function testSplit4() {
+               $string = 'key => value';
+               $array1 = split("[[:space:]=>]",$string,2);
+               $array2 = preg_split('/[[:space:]=>]/',$string,2);
+               foreach($array1 as $key => $value) {
+                       $this->assertTrue(
+                               ($array2[$key] === $value)
+                       );
+               }
+       }
+
+       public function testSplit5() {
+               $string = 'test[1][2][3][4] test[5] test[6]';
+               $array1 = split('\[|\]',$string);
+               $array2 = preg_split('/\[|\]/',$string);
+               foreach($array1 as $key => $value) {
+                       $this->assertTrue(
+                               ($array2[$key] === $value)
+                       );
+               }
+       }
+
+       
+}
 ?>
\ No newline at end of file
index e6bf8a7..2703c6d 100644 (file)
-<?php\r
-/***************************************************************\r
-* Copyright notice\r
-*\r
-* (c) 2009 Oliver Klee (typo3-coding@oliverklee.de)\r
-* All rights reserved\r
-*\r
-* This script is part of the TYPO3 project. The TYPO3 project is\r
-* free software; you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation; either version 2 of the License, or\r
-* (at your option) any later version.\r
-*\r
-* The GNU General Public License can be found at\r
-* http://www.gnu.org/copyleft/gpl.html.\r
-*\r
-* This script is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-* GNU General Public License for more details.\r
-*\r
-* This copyright notice MUST APPEAR in all copies of the script!\r
-***************************************************************/\r
-\r
-require_once(PATH_t3lib . 'class.t3lib_beuserauth.php');\r
-\r
-require_once(PATH_t3lib . 'class.t3lib_tcemain.php');\r
-\r
-/**\r
- * Testcase for the t3lib_TCEmain class in the TYPO3 core.\r
- *\r
- * @package TYPO3\r
- * @subpackage t3lib\r
- *\r
- * @author Oliver Klee <typo3-coding@oliverklee.de>\r
- */\r
-class t3lib_tcemain_testcase extends tx_phpunit_testcase {\r
-       /**\r
-        * @var t3lib_TCEmain\r
-        */\r
-       private $fixture;\r
-\r
-       /**\r
-        * @var t3lib_beUserAuth a simulated logged-in back-end user\r
-        */\r
-       private $backEndUser;\r
-\r
-       public function setUp() {\r
-               $this->backEndUser = $this->createBackEndUser();\r
-\r
-               $this->fixture = new t3lib_TCEmain();\r
-               $this->fixture->start(array(), '', $this->backEndUser);\r
-       }\r
-\r
-       public function tearDown() {\r
-               unset(\r
-                       $this->fixture->BE_USER, $this->fixture, $this->backEndUser\r
-               );\r
-       }\r
-\r
-\r
-       //////////////////////\r
-       // Utility functions\r
-       //////////////////////\r
-\r
-       /**\r
-        * Creates a back-end user.\r
-        *\r
-        * @return t3lib_beUserAuth a back-end user\r
-        */\r
-       private function createBackEndUser() {\r
-               $user = new t3lib_beUserAuth();\r
-               $user->user = array();\r
-\r
-               return $user;\r
-       }\r
-\r
-\r
-       ////////////////////////////////////\r
-       // Tests for the utility functions\r
-       ////////////////////////////////////\r
-\r
-       public function testCreateBackEndUserCreatesBeUserAuthInstance() {\r
-               $this->assertTrue(\r
-                       $this->createBackEndUser() instanceof t3lib_beUserAuth\r
-               );\r
-       }\r
-\r
-\r
-       //////////////////////////////////////\r
-       // Tests for the basic functionality\r
-       //////////////////////////////////////\r
-\r
-       public function testFixtureCanBeCreated() {\r
-               $this->assertTrue(\r
-                       $this->fixture instanceof t3lib_TCEmain\r
-               );\r
-       }\r
-\r
-\r
-       //////////////////////////////////////////\r
-       // Test concerning checkModifyAccessList\r
-       //////////////////////////////////////////\r
-\r
-       public function testCheckModifyAccessListForAdminForContentTableReturnsTrue() {\r
-               $this->fixture->admin = true;\r
-\r
-               $this->assertTrue(\r
-                       $this->fixture->checkModifyAccessList('tt_content')\r
-               );\r
-       }\r
-\r
-       public function testCheckModifyAccessListForNonAdminForContentTableReturnsFalse() {\r
-               $this->fixture->admin = false;\r
-\r
-               $this->assertFalse(\r
-                       $this->fixture->checkModifyAccessList('tt_content')\r
-               );\r
-       }\r
-\r
-       public function testCheckModifyAccessListForNonAdminWithTableModifyAccessForContentTableReturnsTrue() {\r
-               $this->fixture->admin = false;\r
-               $this->backEndUser->groupData['tables_modify'] = 'tt_content';\r
-\r
-               $this->assertTrue(\r
-                       $this->fixture->checkModifyAccessList('tt_content')\r
-               );\r
-       }\r
-\r
-       public function testCheckModifyAccessListForAdminForBeUsersTableReturnsTrue() {\r
-               $this->fixture->admin = true;\r
-\r
-               $this->assertTrue(\r
-                       $this->fixture->checkModifyAccessList('be_users')\r
-               );\r
-       }\r
-\r
-       public function testCheckModifyAccessListForNonAdminForBeUsersTableReturnsFalse() {\r
-               $this->fixture->admin = false;\r
-\r
-               $this->assertFalse(\r
-                       $this->fixture->checkModifyAccessList('be_users')\r
-               );\r
-       }\r
-\r
-       public function testCheckModifyAccessListForNonAdminWithTableModifyAccessForBeUsersTableReturnsFalse() {\r
-               $this->fixture->admin = false;\r
-               $this->backEndUser->groupData['tables_modify'] = 'be_users';\r
-\r
-               $this->assertFalse(\r
-                       $this->fixture->checkModifyAccessList('be_users')\r
-               );\r
-       }\r
-}\r
+<?php
+/***************************************************************
+* Copyright notice
+*
+* (c) 2009 Oliver Klee (typo3-coding@oliverklee.de)
+* All rights reserved
+*
+* This script is part of the TYPO3 project. The TYPO3 project is
+* free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* The GNU General Public License can be found at
+* http://www.gnu.org/copyleft/gpl.html.
+*
+* This script is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+require_once(PATH_t3lib . 'class.t3lib_beuserauth.php');
+
+require_once(PATH_t3lib . 'class.t3lib_tcemain.php');
+
+/**
+ * Testcase for the t3lib_TCEmain class in the TYPO3 core.
+ *
+ * @package TYPO3
+ * @subpackage t3lib
+ *
+ * @author Oliver Klee <typo3-coding@oliverklee.de>
+ */
+class t3lib_tcemain_testcase extends tx_phpunit_testcase {
+       /**
+        * @var t3lib_TCEmain
+        */
+       private $fixture;
+
+       /**
+        * @var t3lib_beUserAuth a simulated logged-in back-end user
+        */
+       private $backEndUser;
+
+       public function setUp() {
+               $this->backEndUser = $this->createBackEndUser();
+
+               $this->fixture = new t3lib_TCEmain();
+               $this->fixture->start(array(), '', $this->backEndUser);
+       }
+
+       public function tearDown() {
+               unset(
+                       $this->fixture->BE_USER, $this->fixture, $this->backEndUser
+               );
+       }
+
+
+       //////////////////////
+       // Utility functions
+       //////////////////////
+
+       /**
+        * Creates a back-end user.
+        *
+        * @return t3lib_beUserAuth a back-end user
+        */
+       private function createBackEndUser() {
+               $user = new t3lib_beUserAuth();
+               $user->user = array();
+
+               return $user;
+       }
+
+
+       ////////////////////////////////////
+       // Tests for the utility functions
+       ////////////////////////////////////
+
+       public function testCreateBackEndUserCreatesBeUserAuthInstance() {
+               $this->assertTrue(
+                       $this->createBackEndUser() instanceof t3lib_beUserAuth
+               );
+       }
+
+
+       //////////////////////////////////////
+       // Tests for the basic functionality
+       //////////////////////////////////////
+
+       public function testFixtureCanBeCreated() {
+               $this->assertTrue(
+                       $this->fixture instanceof t3lib_TCEmain
+               );
+       }
+
+
+       //////////////////////////////////////////
+       // Test concerning checkModifyAccessList
+       //////////////////////////////////////////
+
+       public function testCheckModifyAccessListForAdminForContentTableReturnsTrue() {
+               $this->fixture->admin = true;
+
+               $this->assertTrue(
+                       $this->fixture->checkModifyAccessList('tt_content')
+               );
+       }
+
+       public function testCheckModifyAccessListForNonAdminForContentTableReturnsFalse() {
+               $this->fixture->admin = false;
+
+               $this->assertFalse(
+                       $this->fixture->checkModifyAccessList('tt_content')
+               );
+       }
+
+       public function testCheckModifyAccessListForNonAdminWithTableModifyAccessForContentTableReturnsTrue() {
+               $this->fixture->admin = false;
+               $this->backEndUser->groupData['tables_modify'] = 'tt_content';
+
+               $this->assertTrue(
+                       $this->fixture->checkModifyAccessList('tt_content')
+               );
+       }
+
+       public function testCheckModifyAccessListForAdminForBeUsersTableReturnsTrue() {
+               $this->fixture->admin = true;
+
+               $this->assertTrue(
+                       $this->fixture->checkModifyAccessList('be_users')
+               );
+       }
+
+       public function testCheckModifyAccessListForNonAdminForBeUsersTableReturnsFalse() {
+               $this->fixture->admin = false;
+
+               $this->assertFalse(
+                       $this->fixture->checkModifyAccessList('be_users')
+               );
+       }
+
+       public function testCheckModifyAccessListForNonAdminWithTableModifyAccessForBeUsersTableReturnsFalse() {
+               $this->fixture->admin = false;
+               $this->backEndUser->groupData['tables_modify'] = 'be_users';
+
+               $this->assertFalse(
+                       $this->fixture->checkModifyAccessList('be_users')
+               );
+       }
+}
 ?>
\ No newline at end of file