wiki.techinc.nl/tests/phpunit
Timo Tijhof 7929d190b4 WebRequest: Change getFullRequestURL() to use local getProtocol()
Previously it relied on wfGetServerUrl to decide the url,
which passed PROTO_CURRENT on to wfExpandUrl(), when then uses
global $wgRequest and checks getProtocol() on that.

For typical web requests, these would be the same object by
reference, but the needless indirection makes the code harder
to reason about and harder to test.

Instead, check this locally and pass on an explicit HTTP or HTTPS
to wfGetServerUrl/wfExpandUrl.

Change-Id: I797bd2f909625536c3af36f015fb2e94bf922ba9
2019-04-20 00:58:17 +01:00
..
data Merge "registration: Allow @-prefixed keys in manifest_version 2" 2019-02-14 06:38:04 +00:00
docs Add @coversNothing for left over tests and enable sniff 2019-02-02 21:53:40 -08:00
documentation Check line length of HISTORY 2019-04-02 13:10:34 -07:00
includes WebRequest: Change getFullRequestURL() to use local getProtocol() 2019-04-20 00:58:17 +01:00
languages Add ability to override mb_strtoupper in Language::ucfirst 2019-04-17 15:18:44 +00:00
maintenance Default $wgActorTableSchemaMigrationStage to READ_NEW 2019-04-09 13:50:41 -04:00
mocks media: Mark public MediaHandler/ImageHandler methods as such 2019-02-25 10:16:30 +01:00
skins Add @coversNothing for left over tests and enable sniff 2019-02-02 21:53:40 -08:00
structure Add test to check action- messages exist 2019-04-12 17:44:33 +00:00
suites Remove all $wgParser use from core 2019-04-17 15:16:50 +03:00
tests Make copyTestData work on postgres 2019-03-13 22:06:44 +01:00
bootstrap.php phpunit: Call 'teardownTestDB' from shutdown instead of destruct. 2019-03-29 19:52:00 +00:00
HamcrestPHPUnitIntegration.php Use splat operator in HamcrestPHPUnitIntegration 2019-02-26 18:52:03 -08:00
LessFileCompilationTest.php Add @coversNothing for left over tests and enable sniff 2019-02-02 21:53:40 -08:00
Makefile docs: Remove 'code-coverage' placeholder directory 2019-01-25 18:35:46 -08:00
MediaWikiCoversValidator.php Verify that all @covers tags are sane when running tests 2017-12-29 20:19:12 +00:00
MediaWikiLangTestCase.php Mass conversion of $wgContLang to service 2018-08-11 22:44:29 -06:00
MediaWikiLoggerPHPUnitTestListener.php phpunit: Don't include PHPUnitCommand channel in MediaWikiLoggerPHPUnitTestListener 2019-04-07 00:10:16 +01:00
MediaWikiPHPUnitCommand.php Report logs for each individual test failure 2019-03-06 15:13:53 -08:00
MediaWikiPHPUnitResultPrinter.php Report logs for each individual test failure 2019-03-06 15:13:53 -08:00
MediaWikiPHPUnitTestListener.php Add hooks to MediaWikiPHPUnitTestListener start/endTest 2018-09-10 10:44:24 +00:00
MediaWikiTestCase.php Merge "NamespaceInfo service to replace MWNamespace" 2019-04-10 05:46:24 +00:00
MediaWikiTestResult.php Make phpunit.php less hackish, and install the listener unconditionally 2018-09-04 15:30:20 +10:00
MediaWikiTestRunner.php Make phpunit.php less hackish, and install the listener unconditionally 2018-09-04 15:30:20 +10:00
phpunit.php Output only to stderr in unit tests 2018-10-08 21:04:12 +03:00
PHPUnit4And6Compat.php Validate the output of the dump scripts. 2019-03-20 22:25:20 +01:00
README
ResourceLoaderTestCase.php resourceloader: Use 'fallback' as default for ResourceLoaderTestCase 2019-04-15 20:21:00 +01:00
run-tests.bat
suite.xml Merge "Only use "*Test.php" for actual PHPUnit tests" 2018-10-04 15:43:12 +00:00
TODO

== MediaWiki PHPUnit Tests ==

The unit tests for MediaWiki are implemented using the PHPUnit testing
framework and require PHPUnit to run.


=== WARNING ===

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 ==

If you used composer to install MediaWiki's dependencies PHPUnit will already be available, unless
you explicitly specified the --no-dev flag during the install. In this case just run "composer update".

Otherwise follow the installation instructions in the
PHPUnit Manual at:

  https://phpunit.de/manual/current/en/installation.html


== 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 PHP unit tests for MediaWiki can be found at:

	https://www.mediawiki.org/wiki/Manual:PHP_unit_testing