[TASK] Introduce base class for PHPUnit tests
authorMarkus Klein <klein.t3@mfc-linz.at>
Fri, 21 Sep 2012 15:39:07 +0000 (17:39 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 22 Sep 2012 22:18:26 +0000 (00:18 +0200)
Resolves: #41171
Releases: 6.0

Change-Id: I7274abf41766d16eabc5f4a127a9af6ad450066e
Reviewed-on: http://review.typo3.org/14856
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/dbal/Tests/BaseTestCase.php [deleted file]
typo3/sysext/dbal/Tests/DatabaseGeneralTest.php
typo3/sysext/dbal/Tests/DatabaseMssqlTest.php
typo3/sysext/dbal/Tests/DatabaseOracleTest.php
typo3/sysext/dbal/Tests/DatabasePostgresqlTest.php
typo3/sysext/dbal/Tests/SqlParserGeneralTest.php

diff --git a/typo3/sysext/dbal/Tests/BaseTestCase.php b/typo3/sysext/dbal/Tests/BaseTestCase.php
deleted file mode 100644 (file)
index bf0c436..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-namespace TYPO3\CMS\Dbal\Tests;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009 Robert Lemke <robert@typo3.org>
- *  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!
- ***************************************************************/
-/**
- * The mother of all test cases.
- *
- * Subclass this base class if you want to take advantage of the framework
- * capabilities.
- *
- * @author Robert Lemke <robert@typo3.org>
- * @link https://svn.typo3.org/FLOW3/Packages/Testing/trunk/Classes/BaseTestCase.php
- * @package TYPO3
- * @subpackage dbal
- */
-abstract class BaseTestCase extends \tx_phpunit_testcase {
-
-       /**
-        * Creates a proxy class of the specified class which allows
-        * for calling even protected methods and access of protected properties.
-        *
-        * @param string $className Full qualified name of the original class
-        * @return string Full qualified name of the built class
-        * @api
-        */
-       protected function buildAccessibleProxy($className) {
-               $accessibleClassName = uniqid('AccessibleTestProxy');
-               $class = new \ReflectionClass($className);
-               $abstractModifier = $class->isAbstract() ? 'abstract ' : '';
-               eval('
-                       ' . $abstractModifier . 'class ' . $accessibleClassName . ' extends ' . $className . ' {
-                               public function _call($methodName) {
-                                       return call_user_func_array(array($this, $methodName), array_slice(func_get_args(), 1));
-                               }
-                               public function _callRef($methodName, &$arg1 = NULL, &$arg2 = NULL, &$arg3 = NULL, &$arg4 = NULL, &$arg5 = NULL, &$arg6 = NULL, &$arg7 = NULL, &$arg8 = NULL, &$arg9 = NULL) {
-                                       switch (func_num_args()) {
-                                               case 0 : return $this->$methodName();
-                                               case 1 : return $this->$methodName($arg1);
-                                               case 2 : return $this->$methodName($arg1, $arg2);
-                                               case 3 : return $this->$methodName($arg1, $arg2, $arg3);
-                                               case 4 : return $this->$methodName($arg1, $arg2, $arg3, $arg4);
-                                               case 5 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5);
-                                               case 6 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
-                                               case 7 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7);
-                                               case 8 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8);
-                                               case 9 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8, $arg9);
-                                       }
-                               }
-                               public function _set($propertyName, $value) {
-                                       $this->$propertyName = $value;
-                               }
-                               public function _setRef($propertyName, &$value) {
-                                       $this->$propertyName = $value;
-                               }
-                               public function _get($propertyName) {
-                                       return $this->$propertyName;
-                               }
-                       }
-               ');
-               return $accessibleClassName;
-       }
-
-}
-
-
-?>
\ No newline at end of file
index 980884f..f175af2 100644 (file)
@@ -8,10 +8,10 @@ namespace TYPO3\CMS\Dbal\Tests;
  * @package TYPO3
  * @subpackage dbal
  */
-class DatabaseGeneralTest extends BaseTestCase {
+class DatabaseGeneralTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
-        * @var t3lib_db
+        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
         */
        protected $db;
 
index 0c94b4d..49b5921 100644 (file)
@@ -2,16 +2,16 @@
 namespace TYPO3\CMS\Dbal\Tests;
 
 /**
- * Testcase for class ux_t3lib_db. Testing MS SQL database handling.
+ * Testcase for class ux_TYPO3\CMS\Core\Database\DatabaseConnection. Testing MS SQL database handling.
  *
  * @author Xavier Perseguers <xavier@typo3.org>
  * @package TYPO3
  * @subpackage dbal
  */
-class DatabaseMssqlTest extends BaseTestCase {
+class DatabaseMssqlTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
-        * @var t3lib_db
+        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
         */
        protected $db;
 
index 0ea66a0..34a1e85 100644 (file)
@@ -2,16 +2,16 @@
 namespace TYPO3\CMS\Dbal\Tests;
 
 /**
- * Testcase for class ux_t3lib_db. Testing Oracle database handling.
+ * Testcase for class ux_TYPO3\CMS\Core\Database\DatabaseConnection. Testing Oracle database handling.
  *
  * @author Xavier Perseguers <xavier@typo3.org>
  * @package TYPO3
  * @subpackage dbal
  */
-class DatabaseOracleTest extends BaseTestCase {
+class DatabaseOracleTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
-        * @var t3lib_db
+        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
         */
        protected $db;
 
index 5d01b92..d4a418d 100644 (file)
@@ -2,16 +2,16 @@
 namespace TYPO3\CMS\Dbal\Tests;
 
 /**
- * Testcase for class ux_t3lib_db. Testing PostgreSQL database handling.
+ * Testcase for class ux_TYPO3\CMS\Core\Database\DatabaseConnection. Testing PostgreSQL database handling.
  *
  * @author Xavier Perseguers <xavier@typo3.org>
  * @package TYPO3
  * @subpackage dbal
  */
-class DatabasePostgresqlTest extends BaseTestCase {
+class DatabasePostgresqlTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
-        * @var t3lib_db
+        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
         */
        protected $db;
 
index 42566d5..52b0980 100644 (file)
@@ -31,10 +31,10 @@ namespace TYPO3\CMS\Dbal\Tests;
  * @package TYPO3
  * @subpackage dbal
  */
-class SqlParserGeneralTest extends BaseTestCase {
+class SqlParserGeneralTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
        /**
-        * @var ux_TYPO3\CMS\Core\Database\SqlParser (extended to make protected methods public)
+        * @var \ux_TYPO3\CMS\Core\Database\SqlParser (extended to make protected methods public)
         */
        protected $fixture;