[BUGFIX] Fix install unit-tests
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 25 Aug 2012 12:48:37 +0000 (14:48 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 25 Aug 2012 15:06:50 +0000 (17:06 +0200)
Fix install unit-tests

Change-Id: I67e718c57e6a9e58fc821d91ae4bf3b68ec19391
Resolves: #40183
Related: #40095
Releases: 6.0
Reviewed-on: http://review.typo3.org/14079
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/install/Tests/Unit/InstallToolTest.php [new file with mode: 0644]
typo3/sysext/install/tests/Unit/InstallToolTest.php [deleted file]
typo3/sysext/install/tests/mod/class.tx_installTest.php [deleted file]

diff --git a/typo3/sysext/install/Tests/Unit/InstallToolTest.php b/typo3/sysext/install/Tests/Unit/InstallToolTest.php
new file mode 100644 (file)
index 0000000..fd7ebf8
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+namespace TYPO3\CMS\Install\Tests\Unit;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
+ *  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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  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 class "tx_install"
+ *
+ * @package TYPO3
+ * @subpackage tx_install
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ */
+class InstallToolTest extends \tx_phpunit_testcase {
+
+       /**
+        * @var boolean Enable backup of global and system variables
+        */
+       protected $backupGlobals = TRUE;
+
+       /**
+        * @var boolean True, if a test set a different error handler
+        */
+       protected $customErrorHandlerUsed = FALSE;
+
+       /**
+        * Exclude TYPO3_DB from backup/ restore of $GLOBALS
+        * because resource types cannot be handled during serializing
+        *
+        * @var array
+        */
+       protected $backupGlobalsBlacklist = array('TYPO3_DB');
+
+       /**
+        * Restore error handler if a different one was set during tests
+        */
+       public function tearDown() {
+               if ($this->customErrorHandlerUsed === TRUE) {
+                       restore_error_handler();
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function generateConfigFormThrowsNoWarningHandlingContentOfTypo3ConfVarsExtensionAdded() {
+               $GLOBALS['TYPO3_CONF_VARS_extensionAdded'] = array();
+               // The '/r' triggers a warning if the content is not properly quoted in the regex
+               $GLOBALS['TYPO3_CONF_VARS_extensionAdded']['key1']['key2'] = 'FILE:EXT:rtehtmlarea/res';
+               $GLOBALS['TYPO3_CONF_VARS'] = array();
+               $GLOBALS['TYPO3_CONF_VARS']['key1']['key2'] = 'foo';
+               set_error_handler(array($this, 'errorHandlerCallback'), E_ALL & ~(E_STRICT | E_NOTICE));
+               $this->customErrorHandlerUsed = TRUE;
+               require_once PATH_site . 'typo3/sysext/install/mod/class.tx_install.php';
+               /** @var $instance \TYPO3\CMS\Install\Installer */
+               $instance = $this->getMock('TYPO3\\CMS\\Install\\Installer', array('otherMethod'), array('otherMethod'), '', FALSE);
+               $instance->generateConfigForm('get_form');
+       }
+
+       /**
+        * Set as error handler in test
+        * generateConfigFormThrowsNoWarningHandlingContentOfTypo3ConfVarsExtensionAdded
+        *
+        * @param $errorNumber
+        * @throws Exception
+        */
+       public function errorHandlerCallback($errorNumber) {
+               throw new \Exception('Error thrown');
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/tests/Unit/InstallToolTest.php b/typo3/sysext/install/tests/Unit/InstallToolTest.php
deleted file mode 100644 (file)
index f31cd0b..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Tests\Unit;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
- *  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.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  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 class "tx_install"
- *
- * @package TYPO3
- * @subpackage tx_install
- * @author Christian Kuhn <lolli@schwarzbu.ch>
- */
-class InstallToolTest extends tx_phpunit_testcase {
-
-       /**
-        * @var boolean Enable backup of global and system variables
-        */
-       protected $backupGlobals = TRUE;
-
-       /**
-        * @var boolean True, if a test set a different error handler
-        */
-       protected $customErrorHandlerUsed = FALSE;
-
-       /**
-        * Exclude TYPO3_DB from backup/ restore of $GLOBALS
-        * because resource types cannot be handled during serializing
-        *
-        * @var array
-        */
-       protected $backupGlobalsBlacklist = array('TYPO3_DB');
-
-       /**
-        * Restore error handler if a different one was set during tests
-        */
-       public function tearDown() {
-               if ($this->customErrorHandlerUsed === TRUE) {
-                       restore_error_handler();
-               }
-       }
-
-       /**
-        * @test
-        */
-       public function generateConfigFormThrowsNoWarningHandlingContentOfTypo3ConfVarsExtensionAdded() {
-               $GLOBALS['TYPO3_CONF_VARS_extensionAdded'] = array();
-               // The '/r' triggers a warning if the content is not properly quoted in the regex
-               $GLOBALS['TYPO3_CONF_VARS_extensionAdded']['key1']['key2'] = 'FILE:EXT:rtehtmlarea/res';
-               $GLOBALS['TYPO3_CONF_VARS'] = array();
-               $GLOBALS['TYPO3_CONF_VARS']['key1']['key2'] = 'foo';
-               set_error_handler(array($this, 'errorHandlerCallback'), E_ALL & ~(E_STRICT | E_NOTICE));
-               $this->customErrorHandlerUsed = TRUE;
-               require_once PATH_site . 'typo3/sysext/install/mod/class.tx_install.php';
-               /** @var $instance \TYPO3\CMS\Install\Installer */
-               $instance = $this->getMock('TYPO3\\CMS\\Install\\Installer', array('otherMethod'), array('otherMethod'), '', FALSE);
-               $instance->generateConfigForm('get_form');
-       }
-
-       /**
-        * Set as error handler in test
-        * generateConfigFormThrowsNoWarningHandlingContentOfTypo3ConfVarsExtensionAdded
-        *
-        * @param $errorNumber
-        * @throws Exception
-        */
-       public function errorHandlerCallback($errorNumber) {
-               throw new \Exception('Error thrown');
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/install/tests/mod/class.tx_installTest.php b/typo3/sysext/install/tests/mod/class.tx_installTest.php
deleted file mode 100644 (file)
index 1a97882..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_install_Test and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/install/Tests/Unit/InstallToolTest.php
- */
-require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('install') . 'Tests/Unit/InstallToolTest.php';
-?>
\ No newline at end of file