wiki.techinc.nl/tests/phpunit
Antoine Musso c1cd8d8b1e tests: move slow ScopeStructureTest out of structure
While looking at the list of tests for an extension I found 3000+
ScopeStructureTest which are generated from the php files in
mediawiki/core (more precisely `$wgAutoloadLocalClasses`):
* those tests take 21 seconds to complete on my machine.
* None were generated for the extension being tested, those tests are
  thus solely affected by mediawiki/core.

`tests/phpunit/structure` is included in the `extensions` and `skins`
PHPUnit testsuites and any patches made to them would run that 21
seconds suite even though its only testing mediawiki/core.

Move the test outside of `structure` so it is no longer run for
`extensions` and `skins`.

Bug: T225730
Change-Id: I628210b8b270773f3dad12bbde9d72f0328fcceb
(cherry picked from commit d10835b8bc933a49724010f0c39dfeaccfa9108c)
2025-07-01 13:02:37 +00:00
..
data Merge "Add namespace to maintenance/includes classes" 2024-10-15 22:50:33 +00:00
docs Add namespace to maintenance/includes classes 2024-10-09 11:02:09 -04:00
includes BlockListPagerTest: Fixup tests for pre REL1_44 2025-07-01 11:46:47 +10:00
integration/includes REST: Remove unused setUseParserCache() as potential footgun 2025-04-05 11:35:48 +00:00
maintenance tests: Use namespaced classes 2024-10-21 18:53:02 +02:00
mocks logger: Make log() methods return void 2025-06-18 02:21:42 +00:00
structure tests: move slow ScopeStructureTest out of structure 2025-07-01 13:02:37 +00:00
suites tests: Use namespaced classes 2024-10-21 18:53:02 +02:00
tests tests: Add missing documentation to class properties 2024-09-18 17:25:42 +00:00
unit tests: move slow ScopeStructureTest out of structure 2025-07-01 13:02:37 +00:00
bootstrap.common.php
bootstrap.integration.php
bootstrap.maintenance.php
bootstrap.php phpunit: Fix bootstrap script when no extensions are installed 2025-02-21 22:24:30 +00:00
DynamicPropertyTestHelper.php Drop PHP 7.4/8.0 support from master (forward-port from MW 1.42) 2025-06-18 10:53:22 +01:00
getPHPUnitExtensionsAndSkins.php phpunit: Fix bootstrap script when no extensions are installed 2025-02-21 22:24:30 +00:00
HamcrestPHPUnitIntegration.php
JsonSchemaAssertionTrait.php REST: validate JSON in tests 2024-09-20 15:42:32 +00:00
MediaWikiCoversValidator.php
MediaWikiDeprecatedConfigPHPUnitExtension.php
MediaWikiGroupValidator.php
MediaWikiIntegrationTestCase.php title: Reset cached Title objects between tests 2025-05-27 12:35:10 +00:00
MediaWikiLangTestCase.php
MediaWikiLoggerPHPUnitExtension.php
MediaWikiPHPUnitResultPrinter.php
MediaWikiTeardownPHPUnitExtension.php
MediaWikiTestCaseTrait.php Use explicit nullable type on parameter arguments 2024-10-16 20:58:33 +02:00
MediaWikiUnitTestCase.php tests: Add missing documentation to class properties 2024-09-18 17:25:42 +00:00
MWTestDox.php
phpunit.php phpunit: Don't override --bootstrap if supplied 2025-01-13 15:14:27 +00:00
README.md
ResourceLoaderTestCase.php Use explicit nullable type on parameter arguments 2024-10-16 20:58:33 +02:00
suite.xml
TestSelectQueryBuilder.php Expand tests for rename user maintenance scripts 2024-10-08 21:51:59 +01:00

MediaWiki PHPUnit tests

WARNING: Integration tests may be destructive and alter or remove parts of your local database. We try to use temporary tables where possible, but you must never run tests on a production server or on a wiki where you don't want to lose data.

Running tests

If you haven't already, run composer update (specifically without --no-dev) in the MediaWiki core directory. This will install PHPUnit.

To read about how to run specific tests, refer to:

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

Writing tests

A guide to writing PHPUnit tests for MediaWiki can be found at:

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