Use Horde_Test.
authorJan Schneider <jan@horde.org>
Tue, 12 Oct 2010 16:36:38 +0000 (18:36 +0200)
committerJan Schneider <jan@horde.org>
Tue, 12 Oct 2010 17:01:02 +0000 (19:01 +0200)
framework/Support/test/Horde/Support/AllTests.php

index 31fe77e..a147e80 100644 (file)
@@ -1,58 +1,36 @@
 <?php
 /**
+ * Horde_Support test suite
+ *
+ * @author     Jan Schneider <jan@horde.org>
+ * @license    http://opensource.org/licenses/bsd-license.php
  * @category   Horde
  * @package    Support
  * @subpackage UnitTests
- * @copyright  2008-2009 The Horde Project (http://www.horde.org/)
- * @license    http://opensource.org/licenses/bsd-license.php
  */
 
+/**
+ * Define the main method
+ */
 if (!defined('PHPUnit_MAIN_METHOD')) {
     define('PHPUnit_MAIN_METHOD', 'Horde_Support_AllTests::main');
 }
 
-require_once 'PHPUnit/Framework.php';
-require_once 'PHPUnit/TextUI/TestRunner.php';
-
-class Horde_Support_AllTests {
-
-    public static function main()
-    {
-        PHPUnit_TextUI_TestRunner::run(self::suite());
-    }
-
-    public static function suite()
-    {
-        // Catch strict standards
-        error_reporting(E_ALL | E_STRICT);
-
-        // Set up autoload
-        set_include_path(dirname(__FILE__) . '/../../../lib' . PATH_SEPARATOR . get_include_path());
-        if (!spl_autoload_functions()) {
-            spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'\\\\\', \'_\'), \'/\', $class); include "$filename.php";'));
-        }
-
-        $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Support');
-
-        $basedir = dirname(__FILE__);
-        $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/');
-
-        foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) {
-            if ($file->isFile() && preg_match('/Test.php$/', $file->getFilename())) {
-                $pathname = $file->getPathname();
-                require $pathname;
-
-                $class = str_replace(DIRECTORY_SEPARATOR, '_',
-                                     preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname));
-                $suite->addTestSuite('Horde_Support_' . $class);
-            }
-        }
-
-        return $suite;
-    }
+/**
+ * Prepare the test setup.
+ */
+require_once 'Horde/Test/AllTests.php';
 
+/**
+ * @package    Horde_Support
+ * @subpackage UnitTests
+ */
+class Horde_Support_AllTests extends Horde_Test_AllTests
+{
 }
 
+Horde_Support_AllTests::init('Horde_Support', __FILE__);
+
 if (PHPUnit_MAIN_METHOD == 'Horde_Support_AllTests::main') {
     Horde_Support_AllTests::main();
 }