wiki.techinc.nl/tests/phpunit
Tim Starling 504fe2af11 Respect configured default HTTP timeouts, and introduce max timeouts
* Add HttpRequestFactory::createMultiClient(), which returns a
  MultiHttpClient with configured defaults applied. This is similar to
  the recently-deprecated Http::createMultiClient().
* Introduce $wgHTTPMaxTimeout and $wgHTTPMaxConnectTimeout which, if set
  to a lower value than their defaults of infinity, will limit the
  applied HTTP timeouts, whether configured or passed on a per-request
  basis. This is based on the frequently correct assumption that ops know
  more about timeouts than developers.
* In case developers believe, after becoming aware of this new situation,
  that they actually do know more about timeouts than ops, it is possible
  to override the configured maximum by passing similarly named options
  to HttpRequestFactory::createMultiClient() and
  HttpRequestFactory::create().
* Apply modern standards to HttpRequestFactory by injecting a logger and
  all configuration parameters used by its backends.
* As in Http, the new createMultiClient() will use a MediaWiki/1.35
  User-Agent and the 'http' channel for logging.
* Document that no proxy will be used for createMultiClient().
  Proxy config is weird and was previously a good reason to use
  MultiHttpClient over HttpRequestFactory.
* Deprecate direct construction of MWHttpRequest without a timeout
  parameter

Bug: T245170
Change-Id: I8252f6c854b98059f4916d5460ea71cf4b580149
2020-05-21 09:30:57 +10:00
..
data Small improvements to DoctrineSchemaBuilder and generateSchemaSql 2020-05-09 16:08:44 +02:00
docs
documentation Update all use of $wgVersion to MW_VERSION 2020-02-25 02:16:12 +00:00
includes Respect configured default HTTP timeouts, and introduce max timeouts 2020-05-21 09:30:57 +10:00
integration/includes Add tests for RevisionList/RevisionItem classes 2020-05-12 09:36:44 -07:00
languages Fix languages/ PSR12.Properties.ConstantVisibility.NotFound 2020-05-16 21:49:02 +01:00
maintenance PageDumpTestDataTrait: Pass a user to WikiPage::doDeleteArticleReal 2020-04-16 17:03:54 +00:00
mocks Fix some PSR12.Properties.ConstantVisibility.NotFound in tests/phpunit/ 2020-05-09 23:55:09 +00:00
skins Use MediaWikiServices::getMessageCache 2020-03-14 14:25:03 +01:00
structure Merge "phpunit: Acknowledge known dberror from SpecialPageFatalTest" 2020-05-19 09:29:23 +00:00
suites Fix some PSR12.Properties.ConstantVisibility.NotFound in tests/phpunit/ 2020-05-09 23:55:09 +00:00
tests phpunit: Mock wgDebugToolbar in MediaWikiTestCaseTest 2020-04-08 15:55:15 +01:00
unit Fix more libs PSR12.Properties.ConstantVisibility.NotFound 2020-05-16 20:13:22 +00:00
bootstrap.maintenance.php
bootstrap.php Call TestSetup::applyInitialConfig() from bootstrap.php 2020-04-21 23:40:23 +00:00
HamcrestPHPUnitIntegration.php
LessFileCompilationTest.php resourceloader: Separate style processing from style file loading 2020-02-12 20:23:24 +00:00
Makefile
MediaWikiCliOptions.php
MediaWikiCoversValidator.php phpunit: Speed up MediaWikiCoversValidator trait 2020-03-08 18:51:38 +00:00
MediaWikiGroupValidator.php
MediaWikiIntegrationTestCase.php Merge "Update setTemporaryHook() to use scopedRegister()" 2020-05-11 04:55:18 +00:00
MediaWikiLangTestCase.php Use MediaWikiServices::getMessageCache 2020-03-14 14:25:03 +01:00
MediaWikiLoggerPHPUnitTestListener.php
MediaWikiPHPUnitCommand.php
MediaWikiPHPUnitResultPrinter.php
MediaWikiPHPUnitTestListener.php
MediaWikiTestCaseTrait.php Add HookRegistry 2020-05-13 11:51:02 +10:00
MediaWikiUnitTestCase.php Update setTemporaryHook() to use scopedRegister() 2020-05-11 14:12:00 +10:00
phpunit.php Use class keyword for classname resolution 2020-03-27 09:33:01 +01:00
PHPUnit4And6Compat.php
PHPUnit6And8Compat.php
README
ResourceLoaderTestCase.php Fix some PSR12.Properties.ConstantVisibility.NotFound in tests/phpunit/ 2020-05-09 23:55:09 +00:00
run-tests.bat
suite.xml phpunit: Consider "risky" tests as failed tests 2020-04-06 18:05:50 +00:00

== MediaWiki PHPUnit Tests ==

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


=== WARNING ===

Some of the integration 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