wiki.techinc.nl/tests/phpunit/includes/api
Timo Tijhof c02513c97e phpunit: Fix tests relying on implicit wgScript/wgArticlePath
A number of tests have hardcoded expections that pass only in WMF CI
where Quibble has LocalSettings.php with $wgScript and $wgArticlePath
set a certain way.

We could fix these by adding setMwGlobals() in their tests, as we
often do, but these are so often forgotten that I'd rather we just
add them to TestSetup.php so that it is simply impossible to write a
test that that passes locally for you (if you have the same config)
but not for someone else.

There is a larger project in there somewhere about expanding this
slowly such that we basically only pluck DB-settings and extension
enablement from LocalSettings and otherwise run the tests with the
default settings in PHPUnit. Pretty much by definition, any (other)
setting you have in LocalSettings is irrelevant because it either:
1. has no effect on the test (majority, harmless either way),
2. has a custom default via TestSetup.php (which has precedence over
   LocalSettings.php),
3. is relevant to the code being tested and the test case correctly
   calls setMwGlobals() to ensure a consistent value during test.
4. is relevant to the tested code but has no override, thus only
   passes if you happen to have the "right" value set for it
   (undesirable).

Case 4 is already categorically impossible for the most common config
settings that influence random code because we give them a value
in TestSetup.php. This patch expands that to include $wgScript
and $wgArticlePath. Perhaps in the future we can think about a way
to do this automatically by either re-applying MainConfigSchema
(sans db settings) or by only selectively applying LocalSettings.php
in the first place.

This patch follows-up I072ddf89562fe, which added a test case in
WikitextContentHandlerIntegrationTest.php that assumed "/index.php"
as the value of $wgScript. This passes in WMF CI since Quibble uses
that value, but the tests failed in most local development installs
since those tend to use "/w" instead.

Rather than one-off fixing that one test with overrideConfigValues(),
switch to a more general fixture, since the precise values don't
matter for this test.

Bug: T349087
Bug: T277470
Change-Id: If4304b7ca4a838bd892d4516a0b5c6dfbc30986e
2024-05-05 00:00:01 +00:00
..
format tests: Namespace api tests 2024-02-18 15:47:04 +00:00
query phpunit: Fix tests relying on implicit wgScript/wgArticlePath 2024-05-05 00:00:01 +00:00
Validator tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiAcquireTempUserNameTest.php Update wgAutoCreateTempUser config defaults 2024-04-03 16:25:47 +00:00
ApiBaseTest.php StatusValue: Deprecate combining MessageSpecifier and parameters array 2024-05-03 17:04:27 +02:00
ApiBlockInfoTraitTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiBlockTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiChangeContentModelTest.php Improve rate limit tests 2024-03-12 14:00:07 +11:00
ApiCheckTokenTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiClearHasMsgTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiComparePagesTest.php tests: Migrate to IDatabase::newUpdateQueryBuilder 2024-04-14 18:48:21 +00:00
ApiContinuationManagerTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiCreateTempUserTraitTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiCSPReportTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiDeleteTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiDisabledTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiEditPageTest.php Remove IDBAccessObject from being implemented in many classes 2024-02-19 10:50:02 +01:00
ApiEntryPointTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiErrorFormatterTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiFeedRecentChangesTest.php Update help text for 'hideanons' in ApiFeedRecentChanges API 2024-02-22 17:20:28 +00:00
ApiLoginTest.php tests: Migrate to IDatabase::newInsertQueryBuilder 2024-04-14 21:56:07 +02:00
ApiLogoutTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiMainTest.php tests: Use IDatabase for mocking instead of DBConnRef 2024-05-02 22:11:12 +00:00
ApiMessageTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiMoveTest.php Improve rate limit tests 2024-03-12 14:00:07 +11:00
ApiOpenSearchTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiOptionsTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiPageSetTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiParseTest.php [OutputTransform] Add data-mw-parsoid-version to wrapper div 2024-04-29 12:36:50 -04:00
ApiProtectTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiPurgeTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiResultTest.php ApiResult: Make array ordering consistent across PHP versions 2024-04-05 11:22:15 +02:00
ApiRevisionDeleteTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiRollbackTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiSetNotificationTimestampIntegrationTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiStashEditTest.php Update wgAutoCreateTempUser config defaults 2024-04-03 16:25:47 +00:00
ApiTestCase.php Formally deprecate code marked with @deprecated 2024-05-03 18:25:03 +03:00
ApiTestContext.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiUnblockTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiUndeleteTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiUploadTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiUploadTestCase.php api: Reduce use of WebRequest in action=upload 2024-03-29 21:04:59 +00:00
ApiUsageExceptionTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiUserrightsTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
ApiWatchTest.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
generateRandomImages.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
MockApi.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
MockApiQueryBase.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00
RandomImageGenerator.php tests: Namespace api tests 2024-02-18 15:47:04 +00:00