From 25a35afe20482f7554e9db75c1147d5c9cebc977 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Tue, 21 Dec 2010 18:11:22 +0000 Subject: [PATCH] Installer and doc fixups thanks to Zak Greant. --- tests/phpunit/Makefile | 23 ++++++------ tests/phpunit/README | 62 ++++++++++++++++++++------------ tests/phpunit/install-phpunit.sh | 2 ++ 3 files changed, 55 insertions(+), 32 deletions(-) diff --git a/tests/phpunit/Makefile b/tests/phpunit/Makefile index 26c39f321f..61bfc17f71 100644 --- a/tests/phpunit/Makefile +++ b/tests/phpunit/Makefile @@ -9,21 +9,25 @@ PU = ${PHP} phpunit.php --configuration ${CONFIG_FILE} ${FLAGS} all test: warning warning: - # Use 'make help' to get usage + @echo "Run 'make help' to get usage" + @echo "" @echo "WARNING -- some tests are DESTRUCTIVE and will alter your wiki." @echo "DO NOT RUN THESE TESTS on a production wiki." @echo "" - @echo "Until the default suites are made non-destructive, you can run" + @echo "Until the default tests are made non-destructive, you can run" @echo "the destructive tests like so:" - @echo " make destructive" + @echo "" + @echo " make destructive" @echo "" @echo "Some tests are expected to be safe, you can run them with" - @echo " make safe" @echo "" - @echo "You are recommended to run them with read-only credentials, though." + @echo " make safe" + @echo "" + @echo "You are recommended to run the tests with read-only credentials." @echo "" @echo "If you don't have a database running, you can still run" - @echo " make databaseless" + @echo "" + @echo " make databaseless" @echo "" destructive: phpunit @@ -32,17 +36,16 @@ phpunit: ${PU} install: - php install-phpunit.sh + ./install-phpunit.sh tap: ${PU} --tap coverage: - ${PU} --coverage-html ../../../docs/code-coverage + ${PU} --coverage-html ../../docs/code-coverage parser: ${PU} --group Parser - noparser: ${PU} --exclude-group Parser,Broken @@ -62,7 +65,7 @@ help: # Targets: # phpunit (default) Run all the tests with phpunit # install Install PHPUnit from phpunit.de - # tap Run the tests individually through Test::Harness's prove(1) + # tap Run the tests individually through Test::Harness's prove(1) # help You're looking at it! # coverage Run the tests and generates an HTML code coverage report # You will need the Xdebug PHP extension for the later. diff --git a/tests/phpunit/README b/tests/phpunit/README index ce78270dc0..f683068ca5 100644 --- a/tests/phpunit/README +++ b/tests/phpunit/README @@ -1,35 +1,53 @@ == MediaWiki PHPUnit Tests == -Some quickie unit tests done with the PHPUnit testing framework. To run the -test suite, run 'make test' in this (maintenance/tests/phpunit) directory. +The unit tests for MediaWiki are implemented using the PHPUnit testing +framework and require PHPUnit to run. + === WARNING === -The current versions of some of these tests are DESTRUCTIVE AND WILL ALTER -YOUR WIKI'S CONTENTS. DO NOT RUN ON A PRODUCTION SYSTEM OR ONE WHERE YOU -NEED TO RETAIN YOUR DATA. +Some of the unit tests are DESTRUCTIVE and WILL ALTER YOUR WIKI'S CONTENTS. + +DO NOT RUN THESE TESTS ON A PRODUCTION SYSTEM OR ON ANY SYSTEM WHERE YOU NEED +TO RETAIN YOUR DATA. -=== Installation === -PHPUnit is no longer maintained by PEAR. To get the current version of -PHPUnit, first uninstall any old version of PHPUnit or PHPUnit2 from PEAR, -then install the current version from phpunit.de like this: +== Installation == - pear channel-discover pear.phpunit.de - pear install phpunit/PHPUnit +If PHPUnit is not installed, follow the installation instructions in the +PHPUnit Manual at: -You also may wish to install this via your normal package mechanism: + http://www.phpunit.de/manual/current/en/installation.html - aptitude install phpunit - or - - yum install phpunit -=== Notes === +On Unix-like operating systems, run: + + make install + + +== Running tests == + +The tests are run from your operating system's command line. + +Ensure that you are in the tests/phpunit directory of your MediaWiki +installation. + + +On Unix-like operating systems, the tests runs are controlled with a makefile. +Run command: + + make help + +for a full list of options for running tests. + + +On Windows-family operating systems, run the 'run-tests.bat' batch file. + + +=== Writing tests === + +A guide to writing unit tests for MediaWiki can be found at: + + http://mediawiki.org/wiki/wiki/Unit_Testing -* Label currently broken tests in the group Broken and they will not be run -by phpunit. You can add them to the group by putting the following comment at -the top of the file: - /** - * @group Broken - */ -* Need to fix some broken tests diff --git a/tests/phpunit/install-phpunit.sh b/tests/phpunit/install-phpunit.sh index c0ebd9ef05..5da28d0ccb 100755 --- a/tests/phpunit/install-phpunit.sh +++ b/tests/phpunit/install-phpunit.sh @@ -17,6 +17,8 @@ if ( has_binary phpunit ); then else if ( has_binary pear ); then echo Installing phpunit with pear pear channel-discover pear.phpunit.de + pear channel-discover components.ez.no + pear channel-discover pear.symfony-project.com pear install phpunit/PHPUnit else if ( has_binary apt-get ); then echo Installing phpunit with apt-get -- 2.20.1