From b9eaf07fc2e16506564a6cf69e6a30bdacaeacb0 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Tue, 29 Sep 2009 13:24:29 -0400 Subject: [PATCH] - include PHPUnit/Framework.php - don't use include_once or silence calls in on-the-fly autoloader --- framework/Argv/test/Horde/Argv/AllTests.php | 2 +- framework/Auth/test/Horde/Auth/AllTests.php | 6 ++---- framework/Constraint/test/Horde/Constraint/AllTests.php | 9 ++++++--- framework/Controller/test/Horde/Controller/AllTests.php | 2 +- framework/Date/test/Horde/Date/AllTests.php | 2 +- framework/Http/lib/Horde/Http/Response/Mock.php | 4 ++++ framework/Log/test/Horde/Log/AllTests.php | 2 +- framework/Pdf/test/Horde/Pdf/AllTests.php | 2 +- framework/Routes/test/Horde/Routes/AllTests.php | 4 ++-- framework/Stream_Filter/test/Horde/Stream/Filter/AllTests.php | 5 ++--- framework/Support/test/Horde/Support/AllTests.php | 2 +- framework/Text_Textile/test/Horde/Text/Textile/AllTests.php | 2 +- framework/View/test/Horde/View/AllTests.php | 2 +- framework/Xml_Element/test/Horde/Xml/Element/AllTests.php | 2 +- 14 files changed, 25 insertions(+), 21 deletions(-) diff --git a/framework/Argv/test/Horde/Argv/AllTests.php b/framework/Argv/test/Horde/Argv/AllTests.php index f728a3502..7192f5eb9 100644 --- a/framework/Argv/test/Horde/Argv/AllTests.php +++ b/framework/Argv/test/Horde/Argv/AllTests.php @@ -20,7 +20,7 @@ if (!function_exists('_')) { } } -require_once 'PHPUnit/Framework/TestSuite.php'; +require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; /** diff --git a/framework/Auth/test/Horde/Auth/AllTests.php b/framework/Auth/test/Horde/Auth/AllTests.php index 6c5e09128..b9524aa27 100644 --- a/framework/Auth/test/Horde/Auth/AllTests.php +++ b/framework/Auth/test/Horde/Auth/AllTests.php @@ -15,13 +15,13 @@ */ /** - * Define the main method + * Define the main method */ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Auth_AllTests::main'); } -require_once 'PHPUnit/Framework/TestSuite.php'; +require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; /** @@ -43,7 +43,6 @@ require_once 'PHPUnit/TextUI/TestRunner.php'; */ class Horde_Auth_AllTests { - /** * Main entry point for running the suite. * @@ -80,7 +79,6 @@ class Horde_Auth_AllTests return $suite; } - } if (PHPUnit_MAIN_METHOD == 'Horde_Auth_AllTests::main') { diff --git a/framework/Constraint/test/Horde/Constraint/AllTests.php b/framework/Constraint/test/Horde/Constraint/AllTests.php index c1968084c..2a785384d 100644 --- a/framework/Constraint/test/Horde/Constraint/AllTests.php +++ b/framework/Constraint/test/Horde/Constraint/AllTests.php @@ -8,9 +8,8 @@ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Constraint_AllTests::main'); } -if (!spl_autoload_functions()) { - spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class); @include_once "$filename.php";')); -} +require_once 'PHPUnit/Framework.php'; +require_once 'PHPUnit/TextUI/TestRunner.php'; class Horde_Constraint_AllTests { @@ -21,7 +20,11 @@ class Horde_Constraint_AllTests public static function suite() { + if (!spl_autoload_functions()) { + spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class); include "$filename.php";')); + } set_include_path(dirname(__FILE__) . '/../../../lib' . PATH_SEPARATOR . get_include_path()); + $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Constraint'); $basedir = dirname(__FILE__); diff --git a/framework/Controller/test/Horde/Controller/AllTests.php b/framework/Controller/test/Horde/Controller/AllTests.php index 7819e1bf5..0ff186336 100644 --- a/framework/Controller/test/Horde/Controller/AllTests.php +++ b/framework/Controller/test/Horde/Controller/AllTests.php @@ -16,7 +16,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Controller_AllTests::main'); } -require_once 'PHPUnit/Framework/TestSuite.php'; +require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; /** diff --git a/framework/Date/test/Horde/Date/AllTests.php b/framework/Date/test/Horde/Date/AllTests.php index c68efa643..c5a7eea3e 100644 --- a/framework/Date/test/Horde/Date/AllTests.php +++ b/framework/Date/test/Horde/Date/AllTests.php @@ -11,7 +11,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Date_AllTests::main'); } -require_once 'PHPUnit/Framework/TestSuite.php'; +require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; class Horde_Date_AllTests { diff --git a/framework/Http/lib/Horde/Http/Response/Mock.php b/framework/Http/lib/Horde/Http/Response/Mock.php index 0907c28e7..e6438c59d 100644 --- a/framework/Http/lib/Horde/Http/Response/Mock.php +++ b/framework/Http/lib/Horde/Http/Response/Mock.php @@ -16,4 +16,8 @@ */ class Horde_Http_Response_Mock extends Horde_Http_Response_Base { + public function getBody() + { + return $this->body; + } } diff --git a/framework/Log/test/Horde/Log/AllTests.php b/framework/Log/test/Horde/Log/AllTests.php index be00b3767..d7146c2d4 100644 --- a/framework/Log/test/Horde/Log/AllTests.php +++ b/framework/Log/test/Horde/Log/AllTests.php @@ -40,7 +40,7 @@ class Horde_Log_AllTests public static function suite() { if (!spl_autoload_functions()) { - spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class); @include_once "$filename.php";')); + spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class); include "$filename.php";')); } set_include_path(dirname(__FILE__) . '/../../../lib' . PATH_SEPARATOR . get_include_path()); diff --git a/framework/Pdf/test/Horde/Pdf/AllTests.php b/framework/Pdf/test/Horde/Pdf/AllTests.php index ef53db602..1e537928a 100644 --- a/framework/Pdf/test/Horde/Pdf/AllTests.php +++ b/framework/Pdf/test/Horde/Pdf/AllTests.php @@ -12,7 +12,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde::Pdf::AllTests::main'); } -require_once 'PHPUnit/Framework/TestSuite.php'; +require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; /** diff --git a/framework/Routes/test/Horde/Routes/AllTests.php b/framework/Routes/test/Horde/Routes/AllTests.php index 17712a0c3..9e1a24f5f 100644 --- a/framework/Routes/test/Horde/Routes/AllTests.php +++ b/framework/Routes/test/Horde/Routes/AllTests.php @@ -24,7 +24,7 @@ require_once "$lib/Mapper.php"; require_once "$lib/Route.php"; require_once "$lib/Exception.php"; -require_once 'PHPUnit/Framework/TestSuite.php'; +require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; /** @@ -44,7 +44,7 @@ class Horde_Routes_AllTests $basedir = dirname(__FILE__); $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/'); - foreach(new RecursiveIteratorIterator( + foreach (new RecursiveIteratorIterator( new RecursiveDirectoryIterator($basedir)) as $file) { if ($file->isFile() && preg_match('/Test.php$/', $file->getFilename())) { $pathname = $file->getPathname(); diff --git a/framework/Stream_Filter/test/Horde/Stream/Filter/AllTests.php b/framework/Stream_Filter/test/Horde/Stream/Filter/AllTests.php index a7842cb11..a48829a17 100644 --- a/framework/Stream_Filter/test/Horde/Stream/Filter/AllTests.php +++ b/framework/Stream_Filter/test/Horde/Stream/Filter/AllTests.php @@ -11,9 +11,8 @@ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Stream_Filter_AllTests::main'); } -if (!spl_autoload_functions()) { - spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class); @include_once "$filename.php";')); -} +require_once 'PHPUnit/Framework.php'; +require_once 'PHPUnit/TextUI/TestRunner.php'; /** * @package Horde_Stream_Filter diff --git a/framework/Support/test/Horde/Support/AllTests.php b/framework/Support/test/Horde/Support/AllTests.php index c78680f48..98f7d660c 100644 --- a/framework/Support/test/Horde/Support/AllTests.php +++ b/framework/Support/test/Horde/Support/AllTests.php @@ -11,7 +11,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Support_AllTests::main'); } -require_once 'PHPUnit/Framework/TestSuite.php'; +require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; class Horde_Support_AllTests { diff --git a/framework/Text_Textile/test/Horde/Text/Textile/AllTests.php b/framework/Text_Textile/test/Horde/Text/Textile/AllTests.php index 9e41caf79..4c06a5273 100755 --- a/framework/Text_Textile/test/Horde/Text/Textile/AllTests.php +++ b/framework/Text_Textile/test/Horde/Text/Textile/AllTests.php @@ -9,7 +9,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Text_Textile_AllTests::main'); } -require_once 'PHPUnit/Framework/TestSuite.php'; +require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; /** diff --git a/framework/View/test/Horde/View/AllTests.php b/framework/View/test/Horde/View/AllTests.php index 424ccf970..eefb6231a 100644 --- a/framework/View/test/Horde/View/AllTests.php +++ b/framework/View/test/Horde/View/AllTests.php @@ -33,7 +33,7 @@ class Horde_View_AllTests { // Set up autoload set_include_path(dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'lib' . PATH_SEPARATOR . get_include_path()); if (!spl_autoload_functions()) { - spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class); @include_once "$filename.php";')); + spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class); include "$filename.php";')); } // Build the suite diff --git a/framework/Xml_Element/test/Horde/Xml/Element/AllTests.php b/framework/Xml_Element/test/Horde/Xml/Element/AllTests.php index b80b1c370..530ad5257 100644 --- a/framework/Xml_Element/test/Horde/Xml/Element/AllTests.php +++ b/framework/Xml_Element/test/Horde/Xml/Element/AllTests.php @@ -11,7 +11,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Horde_Xml_Element_AllTests::main'); } -require_once 'PHPUnit/Framework/TestSuite.php'; +require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; class Horde_Xml_Element_AllTests { -- 2.11.0