From 41a3400f919911c15f1954eedc8eb6304e8d5ed8 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 20 May 2007 15:19:28 +0000 Subject: [PATCH] tests: * now detect when PHPUnit.php is missing * tweak some require calls --- tests/ArticleTest.php | 5 ++++- tests/GlobalTest.php | 4 ++-- tests/ImageTest.php | 5 +++-- tests/RunTests.php | 9 +++++++++ tests/SanitizerTest.php | 4 ++-- tests/SearchEngineTest.php | 4 +++- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/tests/ArticleTest.php b/tests/ArticleTest.php index bd678565c8..7bda09ed1f 100644 --- a/tests/ArticleTest.php +++ b/tests/ArticleTest.php @@ -3,6 +3,9 @@ require_once( 'PHPUnit.php' ); require_once( '../includes/Defines.php' ); require_once( '../includes/Article.php' ); +require_once( '../includes/Revision.php' ); +require_once( '../includes/ProfilerStub.php' ); +require_once( '../includes/normal/UtfNormal.php' ); class ArticleTest extends PHPUnit_TestCase { var $saveGlobals = array(); @@ -147,4 +150,4 @@ class ArticleTest extends PHPUnit_TestCase { } -?> \ No newline at end of file +?> diff --git a/tests/GlobalTest.php b/tests/GlobalTest.php index 1567a18908..5de64f8d81 100644 --- a/tests/GlobalTest.php +++ b/tests/GlobalTest.php @@ -2,8 +2,8 @@ require_once( 'PHPUnit.php' ); require_once( '../includes/Defines.php' ); -require_once( '../includes/Profiling.php' ); require_once( '../includes/GlobalFunctions.php' ); +require_once( '../includes/Exception.php' ); class GlobalTest extends PHPUnit_TestCase { function GlobalTest( $name ) { @@ -208,4 +208,4 @@ class GlobalTest extends PHPUnit_TestCase { /* TODO: many more! */ } -?> \ No newline at end of file +?> diff --git a/tests/ImageTest.php b/tests/ImageTest.php index b06d4cbf90..5957bec54a 100644 --- a/tests/ImageTest.php +++ b/tests/ImageTest.php @@ -2,9 +2,10 @@ require_once( 'PHPUnit.php' ); require_once( '../includes/Defines.php' ); -require_once( '../includes/Profiling.php' ); +#require_once( '../includes/Profiling.php' ); require_once( '../includes/GlobalFunctions.php' ); require_once( '../includes/Image.php' ); +require_once( '../includes/ImageFunctions.php' ); class ImageTest extends PHPUnit_TestCase { function ImageTest( $name ) { @@ -63,4 +64,4 @@ class ImageTest extends PHPUnit_TestCase { /* TODO: many more! */ } -?> \ No newline at end of file +?> diff --git a/tests/RunTests.php b/tests/RunTests.php index 2b539a4795..1d088dcb80 100644 --- a/tests/RunTests.php +++ b/tests/RunTests.php @@ -10,7 +10,16 @@ define( "MEDIAWIKI", true ); set_include_path( get_include_path() . PATH_SEPARATOR . 'PHPUnit' ); set_include_path( get_include_path() . PATH_SEPARATOR . '..' ); + +// Error handling when requiring PHPUnit.php +function phpunitErrorHandler( $erno, $errstr, $errfile, $errline) { + echo "Unable to include PHPUnit.php, you should install it first (see README).\n"; + exit(1); +} + +set_error_handler('phpunitErrorHandler'); require_once( 'PHPUnit.php' ); +restore_error_handler(); $testOptions = array( 'mysql4' => array( diff --git a/tests/SanitizerTest.php b/tests/SanitizerTest.php index 5babf0ae77..ea53f910b2 100644 --- a/tests/SanitizerTest.php +++ b/tests/SanitizerTest.php @@ -2,7 +2,7 @@ require_once( 'PHPUnit.php' ); require_once( '../includes/Defines.php' ); -require_once( '../includes/Profiling.php' ); +#require_once( '../includes/Profiling.php' ); require_once( '../includes/GlobalFunctions.php' ); require_once( '../includes/Sanitizer.php' ); @@ -62,4 +62,4 @@ class SanitizerTest extends PHPUnit_TestCase { /* TODO: many more! */ } -?> \ No newline at end of file +?> diff --git a/tests/SearchEngineTest.php b/tests/SearchEngineTest.php index 0a02c49c9c..d7809416f3 100644 --- a/tests/SearchEngineTest.php +++ b/tests/SearchEngineTest.php @@ -4,12 +4,14 @@ $IP = '..'; require_once( 'PHPUnit.php' ); require_once( '../includes/Defines.php' ); require_once( '../includes/DefaultSettings.php' ); -require_once( '../includes/Profiling.php' ); +#require_once( '../includes/Profiling.php' ); require_once( '../includes/Hooks.php' ); require_once( '../includes/MagicWord.php' ); require_once( '../languages/Language.php' ); require_once( '../includes/SearchEngine.php' ); +require_once( '../includes/SearchMySQL.php' ); +require_once( '../includes/SearchMySQL4.php' ); /** @todo document */ class SearchEngine_TestCase extends PHPUnit_TestCase { -- 2.20.1