From: Jan Schneider Date: Thu, 3 Dec 2009 12:05:04 +0000 (+0100) Subject: One test suite to rule them all. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=bf8fc986126bdbd1eb56a30d5308ab1247d83f7f;p=horde.git One test suite to rule them all. --- diff --git a/framework/Argv/test/Horde/Argv/AllTests.php b/framework/Argv/test/Horde/Argv/AllTests.php index a97d8f6fd..b1e2039c0 100644 --- a/framework/Argv/test/Horde/Argv/AllTests.php +++ b/framework/Argv/test/Horde/Argv/AllTests.php @@ -10,68 +10,38 @@ * @subpackage UnitTests */ -if (!defined('PHPUnit_MAIN_METHOD')) { - define('PHPUnit_MAIN_METHOD', 'Horde_Argv_AllTests::main'); -} - if (!function_exists('_')) { function _($t) { return $t; } } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; - /** - * @package Horde_Argv - * @subpackage UnitTests + * Define the main method */ -class Horde_Argv_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";')); - } - - // Test base classes and helper objects - require_once dirname(__FILE__) . '/TestCase.php'; - require_once dirname(__FILE__) . '/ConflictTestCase.php'; - require_once dirname(__FILE__) . '/InterceptedException.php'; - require_once dirname(__FILE__) . '/InterceptingParser.php'; - - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Argv'); - - $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; +if (!defined('PHPUnit_MAIN_METHOD')) { + define('PHPUnit_MAIN_METHOD', 'Horde_Url_AllTests::main'); +} - $class = str_replace(DIRECTORY_SEPARATOR, '_', - preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname)); - $suite->addTestSuite('Horde_Argv_' . $class); - } - } +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; - return $suite; - } +/* Test base classes and helper objects */ +require_once dirname(__FILE__) . '/TestCase.php'; +require_once dirname(__FILE__) . '/ConflictTestCase.php'; +require_once dirname(__FILE__) . '/InterceptedException.php'; +require_once dirname(__FILE__) . '/InterceptingParser.php'; +/** + * @package Horde_Url + * @subpackage UnitTests + */ +class Horde_Url_AllTests extends Horde_Test_AllTests +{ } -if (PHPUnit_MAIN_METHOD == 'Horde_Argv_AllTests::main') { - Horde_Argv_AllTests::main(); +if (PHPUnit_MAIN_METHOD == 'Horde_Url_AllTests::main') { + Horde_Url_AllTests::main('Horde_Url', __FILE__); } diff --git a/framework/Auth/test/Horde/Auth/AllTests.php b/framework/Auth/test/Horde/Auth/AllTests.php index 398a95adf..a003df49a 100644 --- a/framework/Auth/test/Horde/Auth/AllTests.php +++ b/framework/Auth/test/Horde/Auth/AllTests.php @@ -1,6 +1,6 @@ - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Auth */ -class Horde_Auth_AllTests +class Horde_Auth_AllTests extends Horde_Test_AllTests { - /** - * Main entry point for running the suite. - * - * @return NULL - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - /** - * Collect the unit tests of this directory into a new suite. - * - * @return PHPUnit_Framework_TestSuite The test suite. - */ - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Auth'); - - $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_Auth_' . $class); - } - } - - return $suite; - } } if (PHPUnit_MAIN_METHOD == 'Horde_Auth_AllTests::main') { - Horde_Auth_AllTests::main(); + Horde_Auth_AllTests::main('Horde_Auth', __FILE__); } diff --git a/framework/Constraint/test/Horde/Constraint/AllTests.php b/framework/Constraint/test/Horde/Constraint/AllTests.php index cef8231dd..379357781 100644 --- a/framework/Constraint/test/Horde/Constraint/AllTests.php +++ b/framework/Constraint/test/Horde/Constraint/AllTests.php @@ -4,48 +4,26 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { - define('PHPUnit_MAIN_METHOD', 'Horde_Constraint_AllTests::main'); + define('PHPUnit_MAIN_METHOD', 'Horde_Horde_Constraint_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; -class Horde_Constraint_AllTests +/** + * @package Horde_Horde_Constraint + * @subpackage UnitTests + */ +class Horde_Horde_Constraint_AllTests extends Horde_Test_AllTests { - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - // 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_Constraint'); - - $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_Constraint_' . $class); - } - } - - return $suite; - } } -if (PHPUnit_MAIN_METHOD == 'Horde_Constraint_AllTests::main') { - Horde_Constraint_AllTests::main(); +if (PHPUnit_MAIN_METHOD == 'Horde_Horde_Constraint_AllTests::main') { + Horde_Horde_Constraint_AllTests::main('Horde_Horde_Constraint', __FILE__); } diff --git a/framework/Controller/test/Horde/Controller/AllTests.php b/framework/Controller/test/Horde/Controller/AllTests.php index 841f3c673..7f7240959 100644 --- a/framework/Controller/test/Horde/Controller/AllTests.php +++ b/framework/Controller/test/Horde/Controller/AllTests.php @@ -12,58 +12,26 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Controller_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; /** - * @author Mike Naberezny - * @author Derek DeVries - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php - * @category Horde * @package Horde_Controller * @subpackage UnitTests */ -class Horde_Controller_AllTests { - - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - // 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_Controller'); - - $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_Controller_' . $class); - } - } - - return $suite; - } - +class Horde_Controller_AllTests extends Horde_Test_AllTests +{ } if (PHPUnit_MAIN_METHOD == 'Horde_Controller_AllTests::main') { - Horde_Controller_AllTests::main(); + Horde_Controller_AllTests::main('Horde_Controller', __FILE__); } diff --git a/framework/Date/test/Horde/Date/AllTests.php b/framework/Date/test/Horde/Date/AllTests.php index 4c884e9b1..01e0bc9b4 100644 --- a/framework/Date/test/Horde/Date/AllTests.php +++ b/framework/Date/test/Horde/Date/AllTests.php @@ -1,55 +1,32 @@ 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_Date_' . $class); - } - } - - return $suite; - } +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; +/** + * @package Horde_Date + * @subpackage UnitTests + */ +class Horde_Date_AllTests extends Horde_Test_AllTests +{ } if (PHPUnit_MAIN_METHOD == 'Horde_Date_AllTests::main') { - Horde_Date_AllTests::main(); + Horde_Date_AllTests::main('Horde_Date', __FILE__); } diff --git a/framework/Db/test/Horde/Db/AllTests.php b/framework/Db/test/Horde/Db/AllTests.php index d84cf29b3..00dbbd2f8 100644 --- a/framework/Db/test/Horde/Db/AllTests.php +++ b/framework/Db/test/Horde/Db/AllTests.php @@ -12,80 +12,30 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { - define('PHPUnit_MAIN_METHOD', 'Horde_Db_AllTests::main'); + define('PHPUnit_MAIN_METHOD', 'Horde_Url_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; require_once dirname(__FILE__) . '/Adapter/MissingTest.php'; +/* Ensure a default timezone is set. */ +date_default_timezone_set('America/New_York'); + /** - * @author Mike Naberezny - * @author Derek DeVries - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php - * @category Horde - * @package Horde_Db + * @package Horde_Url * @subpackage UnitTests */ -class Horde_Db_AllTests { - - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - // Catch strict standards - error_reporting(E_ALL | E_STRICT); - - // Ensure a default timezone is set. - date_default_timezone_set('America/New_York'); - - // 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";')); - } - - // Build the suite - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Db'); - - $basedir = dirname(__FILE__); - $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/'); - - // Handle the Adapter tests - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir . '/Adapter')) as $file) { - if ($file->isFile() && preg_match('/Suite.php$/', $file->getFilename())) { - $pathname = $file->getPathname(); - require $pathname; - - $class = str_replace(DIRECTORY_SEPARATOR, '_', - preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname)); - $suite->addTestSuite('Horde_Db_' . $class); - } - } - - // Add other tests - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) { - if ($file->isFile() && !preg_match("/^{$baseregexp}Adapter/", $file->getPathname()) && 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_Db_' . $class); - } - } - - - return $suite; - } - +class Horde_Url_AllTests extends Horde_Test_AllTests +{ } -if (PHPUnit_MAIN_METHOD == 'Horde_Db_AllTests::main') { - Horde_Db_AllTests::main(); +if (PHPUnit_MAIN_METHOD == 'Horde_Url_AllTests::main') { + Horde_Url_AllTests::main('Horde_Url', __FILE__); } diff --git a/framework/Feed/test/Horde/Feed/AllTests.php b/framework/Feed/test/Horde/Feed/AllTests.php index 0c4fc14ed..3e85d67f2 100644 --- a/framework/Feed/test/Horde/Feed/AllTests.php +++ b/framework/Feed/test/Horde/Feed/AllTests.php @@ -4,49 +4,26 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Feed_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; -class Horde_Feed_AllTests +/** + * @package Horde_Feed + * @subpackage UnitTests + */ +class Horde_Feed_AllTests extends Horde_Test_AllTests { - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - // 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_Feed'); - - $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_Feed_' . $class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_Feed_AllTests::main') { - Horde_Feed_AllTests::main(); + Horde_Feed_AllTests::main('Horde_Feed', __FILE__); } diff --git a/framework/History/test/Horde/History/AllTests.php b/framework/History/test/Horde/History/AllTests.php index 7f7654efe..a2cdc94e5 100644 --- a/framework/History/test/Horde/History/AllTests.php +++ b/framework/History/test/Horde/History/AllTests.php @@ -19,68 +19,18 @@ if (!defined('PHPUnit_MAIN_METHOD')) { } /** - * The Autoloader allows us to omit "require/include" statements. + * Prepare the test setup. */ -require_once 'Horde/Autoloader.php'; +require_once 'Horde/Test/AllTests.php'; /** - * Combine the tests for this package. - * - * Copyright 2009 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license information (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @category Horde - * @package History - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=History + * @package Horde_History + * @subpackage UnitTests */ -class Horde_History_AllTests +class Horde_History_AllTests extends Horde_Test_AllTests { - - /** - * Main entry point for running the suite. - * - * @return NULL - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - /** - * Collect the unit tests of this directory into a new suite. - * - * @return PHPUnit_Framework_TestSuite The test suite. - */ - public static function suite() - { - // Catch strict standards - error_reporting(E_ALL | E_STRICT); - - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - History'); - - $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_History_' . $class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_History_AllTests::main') { - Horde_History_AllTests::main(); + Horde_History_AllTests::main('Horde_History', __FILE__); } diff --git a/framework/Http/test/Horde/Http/AllTests.php b/framework/Http/test/Horde/Http/AllTests.php index fa9e6b574..3593edaf2 100644 --- a/framework/Http/test/Horde/Http/AllTests.php +++ b/framework/Http/test/Horde/Http/AllTests.php @@ -7,49 +7,26 @@ * @license http://opensource.org/licenses/bsd-license.php */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Http_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; -class Horde_Http_AllTests +/** + * @package Horde_Http + * @subpackage UnitTests + */ +class Horde_Http_AllTests extends Horde_Test_AllTests { - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - // 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_Http'); - - $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_Http_' . $class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_Http_AllTests::main') { - Horde_Http_AllTests::main(); + Horde_Http_AllTests::main('Horde_Http', __FILE__); } diff --git a/framework/Injector/test/Horde/Injector/AllTests.php b/framework/Injector/test/Horde/Injector/AllTests.php index fa64bf2e0..cc2e83820 100644 --- a/framework/Injector/test/Horde/Injector/AllTests.php +++ b/framework/Injector/test/Horde/Injector/AllTests.php @@ -4,48 +4,26 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Injector_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; -class Horde_Injector_AllTests +/** + * @package Horde_Injector + * @subpackage UnitTests + */ +class Horde_Injector_AllTests extends Horde_Test_AllTests { - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - // 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_Injector'); - - $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_Injector_' . $class); - } - } - - return $suite; - } } if (PHPUnit_MAIN_METHOD == 'Horde_Injector_AllTests::main') { - Horde_Injector_AllTests::main(); + Horde_Injector_AllTests::main('Horde_Injector', __FILE__); } diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/AllTests.php b/framework/Kolab_Format/test/Horde/Kolab/Format/AllTests.php index 9c9a16cb5..ab10ab1d2 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/AllTests.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/AllTests.php @@ -19,72 +19,18 @@ if (!defined('PHPUnit_MAIN_METHOD')) { } /** - * The Autoloader allows us to omit "require/include" statements. + * Prepare the test setup. */ -require_once 'Horde/Autoloader.php'; +require_once 'Horde/Test/AllTests.php'; /** - * Combine the tests for this package. - * - * Copyright 2007-2009 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license information (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @category Kolab - * @package Kolab_Format - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Format + * @package Horde_Kolab_Format + * @subpackage UnitTests */ -class Horde_Kolab_Format_AllTests +class Horde_Kolab_Format_AllTests extends Horde_Test_AllTests { - - /** - * Main entry point for running the suite. - * - * @return NULL - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - /** - * Collect the unit tests of this directory into a new suite. - * - * @return PHPUnit_Framework_TestSuite The test suite. - */ - public static function suite() - { - // Catch strict standards - // FIXME: This does not work yet, as we still have a number of - // static methods in basic Horde libraries that are not - // declared as such. There are also strict failures for the - // Horde_Date classes. - //error_reporting(E_ALL | E_STRICT); - - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Kolab_Format'); - - $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_Kolab_Format_' . $class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_Kolab_Format_AllTests::main') { - Horde_Kolab_Format_AllTests::main(); + Horde_Kolab_Format_AllTests::main('Horde_Kolab_Format', __FILE__); } diff --git a/framework/Kolab_FreeBusy/test/Horde/Kolab/FreeBusy/AllTests.php b/framework/Kolab_FreeBusy/test/Horde/Kolab/FreeBusy/AllTests.php index 798125be0..c158bd148 100644 --- a/framework/Kolab_FreeBusy/test/Horde/Kolab/FreeBusy/AllTests.php +++ b/framework/Kolab_FreeBusy/test/Horde/Kolab/FreeBusy/AllTests.php @@ -13,81 +13,25 @@ */ /** - * Define the main method + * Define the main method */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Kolab_FreeBusy_AllTests::main'); } /** - * The Autoloader allows us to omit "require/include" statements. + * Prepare the test setup. */ -require_once 'Horde/Autoloader.php'; +require_once 'Horde/Test/AllTests.php'; /** - * Combine the tests for this package. - * - * Copyright 2007-2009 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license information (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @category Kolab - * @package Kolab_FreeBusy + * @package Horde_Kolab_FreeBusy * @subpackage UnitTests - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_FreeBusy */ -class Horde_Kolab_FreeBusy_AllTests +class Horde_Kolab_FreeBusy_AllTests extends Horde_Test_AllTests { - - /** - * Main entry point for running the suite. - * - * @return NULL - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - /** - * Collect the unit tests of this directory into a new suite. - * - * @return PHPUnit_Framework_TestSuite The test suite. - */ - public static function suite() - { - // Catch strict standards - // FIXME: This does not work yet, as we still have a number of - // static methods in basic Horde libraries that are not - // declared as such. - //error_reporting(E_ALL | E_STRICT); - - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Kolab_FreeBusy'); - - $basedir = dirname(__FILE__); - $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/'); - - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) { - //@TODO: Fix testing. Working on it... - continue; - 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_Kolab_FreeBusy_' . $class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_Kolab_FreeBusy_AllTests::main') { - Horde_Kolab_FreeBusy_AllTests::main(); + Horde_Kolab_FreeBusy_AllTests::main('Horde_Kolab_FreeBusy', __FILE__); } diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/AllTests.php b/framework/Kolab_Server/test/Horde/Kolab/Server/AllTests.php index 02ca6779c..bdde2d101 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/AllTests.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/AllTests.php @@ -21,63 +21,16 @@ if (!defined('PHPUnit_MAIN_METHOD')) { /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/Autoload.php'; +require_once 'Horde/Test/AllTests.php'; /** - * Combine the tests for this package. - * - * Copyright 2007-2009 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license information (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @category Kolab - * @package Kolab_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server + * @package Horde_Kolab_Server + * @subpackage UnitTests */ -class Horde_Kolab_Server_AllTests +class Horde_Kolab_Server_AllTests extends Horde_Test_AllTests { - - /** - * Main entry point for running the suite. - * - * @return NULL - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - /** - * Collect the unit tests of this directory into a new suite. - * - * @return PHPUnit_Framework_TestSuite The test suite. - */ - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Kolab_Server'); - - $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_Kolab_Server_' . $class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_Kolab_Server_AllTests::main') { - Horde_Kolab_Server_AllTests::main(); + Horde_Kolab_Server_AllTests::main('Horde_Kolab_Server', __FILE__); } diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/AllTests.php b/framework/Kolab_Session/test/Horde/Kolab/Session/AllTests.php index 84267a5e1..4eb2c9ca0 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/AllTests.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/AllTests.php @@ -21,65 +21,16 @@ if (!defined('PHPUnit_MAIN_METHOD')) { /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/Autoload.php'; +require_once 'Horde/Test/AllTests.php'; /** - * Combine the tests for this package. - * - * Copyright 2007-2009 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license information (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @category Kolab - * @package Kolab_Session - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Session + * @package Horde_Kolab_Session + * @subpackage UnitTests */ -class Horde_Kolab_Session_AllTests +class Horde_Kolab_Session_AllTests extends Horde_Test_AllTests { - - /** - * Main entry point for running the suite. - * - * @return NULL - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - /** - * Collect the unit tests of this directory into a new suite. - * - * @return PHPUnit_Framework_TestSuite The test suite. - */ - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Kolab_Session'); - - $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_Kolab_Session_' . $class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_Kolab_Session_AllTests::main') { - Horde_Kolab_Session_AllTests::main(); + Horde_Kolab_Session_AllTests::main('Horde_Kolab_Session', __FILE__); } diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/AllTests.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/AllTests.php index f9990c98e..fd1a12ceb 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/AllTests.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/AllTests.php @@ -13,79 +13,25 @@ */ /** - * Define the main method + * Define the main method */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Kolab_Storage_AllTests::main'); } /** - * The Autoloader allows us to omit "require/include" statements. + * Prepare the test setup. */ -require_once 'Horde/Autoloader.php'; +require_once 'Horde/Test/AllTests.php'; /** - * Combine the tests for this package. - * - * Copyright 2007-2009 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license information (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @category Kolab - * @package Kolab_Storage + * @package Horde_Kolab_Storage * @subpackage UnitTests - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Storage */ -class Horde_Kolab_Storage_AllTests +class Horde_Kolab_Storage_AllTests extends Horde_Test_AllTests { - - /** - * Main entry point for running the suite. - * - * @return NULL - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - /** - * Collect the unit tests of this directory into a new suite. - * - * @return PHPUnit_Framework_TestSuite The test suite. - */ - public static function suite() - { - // Catch strict standards - // FIXME: This does not work yet, as we still have a number of - // static methods in basic Horde libraries that are not - // declared as such. - //error_reporting(E_ALL | E_STRICT); - - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Kolab_Storage'); - - $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_Kolab_Storage_' . $class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_Kolab_Storage_AllTests::main') { - Horde_Kolab_Storage_AllTests::main(); + Horde_Kolab_Storage_AllTests::main('Horde_Kolab_Storage', __FILE__); } diff --git a/framework/Log/test/Horde/Log/AllTests.php b/framework/Log/test/Horde/Log/AllTests.php index 0abfe3fa3..7615f6046 100644 --- a/framework/Log/test/Horde/Log/AllTests.php +++ b/framework/Log/test/Horde/Log/AllTests.php @@ -14,58 +14,26 @@ * @license http://opensource.org/licenses/bsd-license.php BSD */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Log_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; /** - * @category Horde - * @package Horde_Log + * @package Horde_Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ -class Horde_Log_AllTests +class Horde_Log_AllTests extends Horde_Test_AllTests { - - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - // 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_Log'); - - $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 = 'Horde_Log_' . str_replace(DIRECTORY_SEPARATOR, '_', - preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname)); - $suite->addTestSuite($class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_Log_AllTests::main') { - Horde_Log_AllTests::main(); + Horde_Log_AllTests::main('Horde_Log', __FILE__); } diff --git a/framework/Mime/test/Horde/Mime/AllTests.php b/framework/Mime/test/Horde/Mime/AllTests.php index e69de29bb..b42aea17a 100644 --- a/framework/Mime/test/Horde/Mime/AllTests.php +++ b/framework/Mime/test/Horde/Mime/AllTests.php @@ -0,0 +1,34 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @category Horde + * @package Horde_Mime + * @subpackage UnitTests + */ + +/** + * Define the main method + */ +if (!defined('PHPUnit_MAIN_METHOD')) { + define('PHPUnit_MAIN_METHOD', 'Horde_Mime_AllTests::main'); +} + +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; + +/** + * @package Horde_Mime + * @subpackage UnitTests + */ +class Horde_Mime_AllTests extends Horde_Test_AllTests +{ +} + +if (PHPUnit_MAIN_METHOD == 'Horde_Mime_AllTests::main') { + Horde_Mime_AllTests::main('Horde_Mime', __FILE__); +} diff --git a/framework/Notification/test/Horde/Notification/AllTests.php b/framework/Notification/test/Horde/Notification/AllTests.php index 3aaf09bc6..e7045cfd2 100644 --- a/framework/Notification/test/Horde/Notification/AllTests.php +++ b/framework/Notification/test/Horde/Notification/AllTests.php @@ -1,6 +1,6 @@ - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Notification + * @package Horde_Notification + * @subpackage UnitTests */ -class Horde_Notification_AllTests +class Horde_Notification_AllTests extends Horde_Test_AllTests { - - /** - * Main entry point for running the suite. - * - * @return NULL - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - /** - * Collect the unit tests of this directory into a new suite. - * - * @return PHPUnit_Framework_TestSuite The test suite. - */ - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Notification'); - - $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_Notification_' . $class); - } - } - - return $suite; - } - } if (PHPUnit_MAIN_METHOD == 'Horde_Notification_AllTests::main') { - Horde_Notification_AllTests::main(); + Horde_Notification_AllTests::main('Horde_Notification', __FILE__); } diff --git a/framework/Pdf/test/Horde/Pdf/AllTests.php b/framework/Pdf/test/Horde/Pdf/AllTests.php index 176051dcc..30c183e49 100644 --- a/framework/Pdf/test/Horde/Pdf/AllTests.php +++ b/framework/Pdf/test/Horde/Pdf/AllTests.php @@ -8,56 +8,26 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { - define('PHPUnit_MAIN_METHOD', 'Horde::Pdf::AllTests::main'); + define('PHPUnit_MAIN_METHOD', 'Horde_Pdf_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; /** - * Horde_Pdf test suite - * - * @category Horde * @package Horde_Pdf * @subpackage UnitTests */ -class Horde_Pdf_AllTests +class Horde_Pdf_AllTests extends Horde_Test_AllTests { - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - // 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_Pdf'); - - $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 = 'Horde_Pdf_' . str_replace(DIRECTORY_SEPARATOR, '_', - preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname)); - $suite->addTestSuite($class); - } - } - - return $suite; - } - } -if (PHPUnit_MAIN_METHOD == 'Horde::Pdf::AllTests::main') { - Horde_Pdf_AllTests::main(); +if (PHPUnit_MAIN_METHOD == 'Horde_Pdf_AllTests::main') { + Horde_Pdf_AllTests::main('Horde_Pdf', __FILE__); } diff --git a/framework/Routes/test/Horde/Routes/AllTests.php b/framework/Routes/test/Horde/Routes/AllTests.php index 9e1a24f5f..d70e494e4 100644 --- a/framework/Routes/test/Horde/Routes/AllTests.php +++ b/framework/Routes/test/Horde/Routes/AllTests.php @@ -12,54 +12,26 @@ * @package Horde_Routes */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Routes_AllTests::main'); } -error_reporting(E_ALL | E_STRICT); - -$lib = dirname(dirname(dirname(dirname(__FILE__)))) . '/lib/Horde/Routes/'; -require_once "$lib/Utils.php"; -require_once "$lib/Mapper.php"; -require_once "$lib/Route.php"; -require_once "$lib/Exception.php"; - -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; /** - * @package Horde_Routes + * @package Horde_Routes + * @subpackage UnitTests */ -class Horde_Routes_AllTests +class Horde_Routes_AllTests extends Horde_Test_AllTests { - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('Routes'); - - $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($class); - } - } - - return $suite; - } } if (PHPUnit_MAIN_METHOD == 'Horde_Routes_AllTests::main') { - Horde_Routes_AllTests::main(); + Horde_Routes_AllTests::main('Horde_Routes', __FILE__); } diff --git a/framework/Stream_Filter/test/Horde/Stream/Filter/AllTests.php b/framework/Stream_Filter/test/Horde/Stream/Filter/AllTests.php index 4377489fe..d72924f3b 100644 --- a/framework/Stream_Filter/test/Horde/Stream/Filter/AllTests.php +++ b/framework/Stream_Filter/test/Horde/Stream/Filter/AllTests.php @@ -7,55 +7,26 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Stream_Filter_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; /** * @package Horde_Stream_Filter * @subpackage UnitTests */ -class Horde_Stream_Filter_AllTests +class Horde_Stream_Filter_AllTests extends Horde_Test_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_Stream_Filter'); - - $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_Stream_Filter_' . $class); - } - } - - return $suite; - } } if (PHPUnit_MAIN_METHOD == 'Horde_Stream_Filter_AllTests::main') { - Horde_Stream_Filter_AllTests::main(); + Horde_Stream_Filter_AllTests::main('Horde_Stream_Filter', __FILE__); } diff --git a/framework/Support/test/Horde/Support/AllTests.php b/framework/Support/test/Horde/Support/AllTests.php index a07e87e3c..31fe77efe 100644 --- a/framework/Support/test/Horde/Support/AllTests.php +++ b/framework/Support/test/Horde/Support/AllTests.php @@ -23,6 +23,9 @@ class Horde_Support_AllTests { 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()) { diff --git a/framework/Test/package.xml b/framework/Test/package.xml index f4c73f3f9..99b1a46e2 100644 --- a/framework/Test/package.xml +++ b/framework/Test/package.xml @@ -30,6 +30,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + @@ -53,6 +54,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + diff --git a/framework/Text_Textile/test/Horde/Text/Textile/AllTests.php b/framework/Text_Textile/test/Horde/Text/Textile/AllTests.php index 4c06a5273..b9ea31c10 100755 --- a/framework/Text_Textile/test/Horde/Text/Textile/AllTests.php +++ b/framework/Text_Textile/test/Horde/Text/Textile/AllTests.php @@ -5,48 +5,26 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Text_Textile_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; /** - * @category Horde * @package Horde_Text_Textile * @subpackage UnitTests */ -class Horde_Text_Textile_AllTests { - - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Text_Textile'); - - $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_Text_Textile_' . $class); - } - } - - return $suite; - } - +class Horde_Text_Textile_AllTests extends Horde_Test_AllTests +{ } if (PHPUnit_MAIN_METHOD == 'Horde_Text_Textile_AllTests::main') { - Horde_Text_Textile_AllTests::main(); + Horde_Text_Textile_AllTests::main('Horde_Text_Textile', __FILE__); } diff --git a/framework/View/test/Horde/View/AllTests.php b/framework/View/test/Horde/View/AllTests.php index fba118acb..f0146b2a5 100644 --- a/framework/View/test/Horde/View/AllTests.php +++ b/framework/View/test/Horde/View/AllTests.php @@ -8,56 +8,29 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_View_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; - -class Horde_View_AllTests { - - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - // Catch strict standards - error_reporting(E_ALL | E_STRICT); - - // Ensure a default timezone is set. - date_default_timezone_set('America/New_York'); - - // 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";')); - } - - // Build the suite - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_View'); - - $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_View_' . $class); - } - } +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; - return $suite; - } +/* Ensure a default timezone is set. */ +date_default_timezone_set('America/New_York'); +/** + * @package Horde_View + * @subpackage UnitTests + */ +class Horde_View_AllTests extends Horde_Test_AllTests +{ } if (PHPUnit_MAIN_METHOD == 'Horde_View_AllTests::main') { - Horde_View_AllTests::main(); + Horde_View_AllTests::main('Horde_View', __FILE__); } diff --git a/framework/Xml_Element/test/Horde/Xml/Element/AllTests.php b/framework/Xml_Element/test/Horde/Xml/Element/AllTests.php index 530ad5257..7c5946c1a 100644 --- a/framework/Xml_Element/test/Horde/Xml/Element/AllTests.php +++ b/framework/Xml_Element/test/Horde/Xml/Element/AllTests.php @@ -11,39 +11,16 @@ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Xml_Element_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; - -class Horde_Xml_Element_AllTests { - - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Xml_Element'); - - $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_Xml_Element_' . $class); - } - } - - return $suite; - } +require_once 'Horde/Test/AllTests.php'; +/** + * @package Horde_Url + * @subpackage UnitTests + */ +class Horde_Xml_Element_AllTests extends Horde_Test_AllTests +{ } if (PHPUnit_MAIN_METHOD == 'Horde_Xml_Element_AllTests::main') { - Horde_Xml_Element_AllTests::main(); + Horde_Xml_Element_AllTests::main('Horde_Xml_Element', __FILE__); } diff --git a/framework/Yaml/test/Horde/Yaml/AllTests.php b/framework/Yaml/test/Horde/Yaml/AllTests.php index 021dca4fc..4525a46c8 100644 --- a/framework/Yaml/test/Horde/Yaml/AllTests.php +++ b/framework/Yaml/test/Horde/Yaml/AllTests.php @@ -9,60 +9,27 @@ * @subpackage UnitTests */ +/** + * Define the main method + */ if (!defined('PHPUnit_MAIN_METHOD')) { - define('PHPUnit_MAIN_METHOD', 'Horde_Yaml_AllTests::main'); + define('PHPUnit_MAIN_METHOD', 'Horde_Url_AllTests::main'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; +require_once dirname(__FILE__) . '/Helpers.php'; /** - * @category Horde - * @package Horde_Yaml + * @package Horde_Url * @subpackage UnitTests */ -class Horde_Yaml_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";')); - } - - // Test helpers - require_once dirname(__FILE__) . '/Helpers.php'; - - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Yaml'); - - $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_Yaml_' . $class); - } - } - - return $suite; - } - +class Horde_Url_AllTests extends Horde_Test_AllTests +{ } -if (PHPUnit_MAIN_METHOD == 'Horde_Yaml_AllTests::main') { - Horde_Yaml_AllTests::main(); +if (PHPUnit_MAIN_METHOD == 'Horde_Url_AllTests::main') { + Horde_Url_AllTests::main('Horde_Url', __FILE__); }