wiki.techinc.nl/tests/phpunit
Máté Szabó c4e9f987f1 rest: Return a 400 for invalid render IDs
Why:

- The REST API takes an optional renderid param when converting HTML
  back to source wikitext, which is user-provided and may be invalid.
- Invalid render IDs cause an InvalidArgumentException to be thrown that
  causes a 500 response.

What:

- Introduce a new error message for invalid render IDs in the REST API.
- Return a 400 with this new error message for HTML reverse-parses with
  an invalid render ID.

Bug: T385568
Change-Id: I062419fe8952329a39781a49cdca2e94c3996447
(cherry picked from commit cd1d42a5066e4bcb9b9d4ed9b4f7714fd428fea3)
2025-02-04 14:54:50 +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 session: Do not set session.use_trans_sid 2025-01-06 22:12:05 +00:00
integration/includes rest: Return a 400 for invalid render IDs 2025-02-04 14:54:50 +00:00
maintenance tests: Use namespaced classes 2024-10-21 18:53:02 +02:00
mocks AutoLoader: Use require_once rather than require 2024-10-24 01:36:18 +00:00
structure Add DumpableObjectsTest to the database test group 2024-11-08 14:37:40 +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 parser: Gracefully handle invalid ParsoidRenderID keys 2025-02-04 14:54:31 +00:00
bootstrap.common.php
bootstrap.integration.php
bootstrap.maintenance.php
bootstrap.php
DynamicPropertyTestHelper.php
getPHPUnitExtensionsAndSkins.php
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 tests: Use namespaced classes 2024-10-21 18:53:02 +02: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