wiki.techinc.nl/tests/phpunit
Tim Starling fbf4fe4357 In ChronologyProtector fix confusion between DB name and master name
The one caller of LBFactory::getChronologyProtectorTouched() was calling
it with a domain ID instead of a master server name. Using the master
server name to identify replication position makes sense for
ChronologyProtector, since the replication position may be reset when
the master changes, but it is an odd convention for LBFactory. So:

* Rename all $dbName variables in ChronologyProtector to $masterName,
  for clarity.
* Interpret the first parameter to
  ILBFactory::getChronologyProtectorTouched() as a database domain, to
  make its only existing caller work.
* Change the first parameter to ChronologyProtector::getTouched() from a
  string to a strongly typed ILoadBalancer, by analogy with
  applySessionReplicationPosition(). This removes the master name concept
  from the public interface.
* Mark ChronologyProtector @internal. The accessor in LBFactory is
  protected, so extensions can't use it anyway. This is just to clarify
  why I think changing the parameter to getTouched() without b/c is OK.
* Add a simple test which mostly just checks that ChronologyProtector gets
  called with the correct parameters. It's an
  LBFactory/ChronologyProtector integration test.

Change-Id: I3b4832b5a4d7410e94b9c51577b30b31d49bc63d
2020-06-01 12:54:35 +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 In ChronologyProtector fix confusion between DB name and master name 2020-06-01 12:54:35 +10:00
integration/includes build: Bump mediawiki-codesniffer to 31.0.0 2020-05-30 14:56:28 +00:00
languages build: Bump mediawiki-codesniffer to 31.0.0 2020-05-30 14:56:28 +00:00
maintenance build: Bump mediawiki-codesniffer to 31.0.0 2020-05-30 14:56:28 +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 Hooks::run() call site migration 2020-05-30 14:23:28 +00:00
tests phpunit: Mock wgDebugToolbar in MediaWikiTestCaseTest 2020-04-08 15:55:15 +01:00
unit build: Bump mediawiki-codesniffer to 31.0.0 2020-05-30 14:56:28 +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 Hooks::run() call site migration 2020-05-30 14:23:28 +00:00
MediaWikiLangTestCase.php Use MediaWikiServices::getMessageCache 2020-03-14 14:25:03 +01:00
MediaWikiLoggerPHPUnitTestListener.php Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUse 2020-01-10 09:32:25 -08:00
MediaWikiPHPUnitCommand.php
MediaWikiPHPUnitResultPrinter.php phpunit: Move "Logs generated by test" from middle to end of result 2020-05-22 20:48:28 +01:00
MediaWikiPHPUnitTestListener.php Hooks::run() call site migration 2020-05-30 14:23:28 +00:00
MediaWikiTestCaseTrait.php Add HookRegistry 2020-05-13 11:51:02 +10:00
MediaWikiUnitTestCase.php Fix a plethora of class and function call case mismatches 2020-05-26 14:14:46 +01:00
phpunit.php Call ob_start() before running tests 2020-05-25 13:55:28 +10: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