aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/structure
Commit message (Collapse)AuthorAgeFilesLines
...
* add structure test that checks if param schemas are validWendy Quarshie2024-07-231-0/+36
| | | | | Bug: T368133 Change-Id: Ib0e881d13b4709bc31831e1bc7d88ad6041589a1
* Merge @dataProviders in AbstractSchemaValidationTestthiemowmde2024-07-191-22/+4
| | | | | | | The two test functions are identical. They can as well use a single @dataProvider to do the same as before. No coverage is lost. Change-Id: I865b75f8e14e016ad4aa7ffdcf9e4023387b40bb
* Merge "param-settings: Remove backward compatibility code from default"jenkins-bot2024-07-101-20/+24
|\
| * param-settings: Remove backward compatibility code from defaultAtieno2024-07-101-20/+24
| | | | | | | | | | | | | | We no longer have to check for 'body' PARAM_SOURCE from within getParamSettings Bug: T367394 Change-Id: I16075fde2db6ea47f61d1d2df1e07a4ef46b537b
* | Add namespace to the root classes of ObjectCacheEbrahim Byagowi2024-07-102-1/+2
|/ | | | | | | | | And deprecated aliases for the the no namespaced classes. ReplicatedBagOStuff that already is deprecated isn't moved. Bug: T353458 Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
* Merge "Add Special:RestSandbox for exploring REST API"jenkins-bot2024-06-141-24/+32
|\
| * Add Special:RestSandbox for exploring REST APIdaniel2024-06-131-24/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Special:RestSandbox presents a Swagger-UI interface for exploring REST APIs. The available APIs can be configured using RestSandboxSpecs. For now, the default is to support no APIs, so the feature is disabled in production. In the future, it would make sense to expose the wiki's own REST API per default. The corresponding entry in $wgRestSandboxSpecs in LocalSettings.php would look like this: 'mw' => [ 'url' => $wgScriptPath . '/rest.php/', 'name' => 'MediaWiki REST API', ] Note that the spec URL may still change. To also explore the endpoints exposed through RESTbase, we might add: 'wmf-restbase' => [ 'url' => $wgServer . '/api/rest_v1/', 'name' => 'Wikimedia RESTbase API', ] Similarly, we could expose a spec for endpoints on api.wikimedia.org, which could then be explored using the new special page. NOTE: This adds a dependency on the swagger-ui npm library. See T325558 for the security review. Bug: T362006 Change-Id: I1dd5ed82680a28f9c15136b446a2de0398525061
* | tests: Use namespaced classes (2)Umherirrender2024-06-133-0/+3
| | | | | | | | | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I4ff4d0c10820dc2a3b8419b4115fadf81a76f7a2
* | Migrate MediaWiki.rest_api to statslibWendy Quarshie2024-06-111-2/+3
|/ | | | | Bug: T359364 Change-Id: I3646140ee8e16800c43f37958fc4b6ff00edcad6
* Add namespace and deprecation alias to TextContentHandlerEbrahim Byagowi2024-05-201-0/+1
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\Content to TextContentHandler and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: I2c72dacf28ee72fb70b15acdd81d0eb717ea949a
* Use constants provided by MainConfigNames for config namesFunc2024-05-181-1/+1
| | | | Change-Id: I2f29ea8227da64b79b70fcce3decb6e34ea8da5b
* Introduce Modules into the REST frameworkdaniel2024-05-081-45/+68
| | | | | | | Modules group together endpoints by a shared prefix. The idea is that each module has its own version and can generated self-contained self-documentation. This allows clients to have clear expectations about the endpoints of each module, no matter what wiki they are accessing. So far, each wiki may be exposing a different set of endpoints, with no way to provide a spec that describes that set of endpoints in a way that would be consistent across wikis and stable over time. Bug: T362480 Change-Id: Iebcde4645d472d27eee5a30adb6eee12cc7d046b
* REST: introduce getBodyParamSettingsdaniel2024-05-071-0/+40
| | | | | | | | | | | | | | | | | Since we introduced support for the "body" PARAM_SOURCE in getParamSettings, fields in the request body can be defined in the same way that path and query parameters are defined. However, body fields are treated separately by the framework, and the value of body fields are available through getValidatedBody(), rather than getValidatedParams(). Because of that, it makes sense to have a method that returns the param settings just for the body fields. This also allows handler classes to override this method separately to specify body fields. That way, it also becomes possible to have body fields that have the same name as other parameters. Bug: T362850 Change-Id: Ia85bf7e46c949a999052d91f1b0d7d579a880108
* ResourcesTest: Test 'packageFiles' existence tooBartosz Dziewoński2024-04-161-0/+10
| | | | | | Also, reset logo settings to avoid failures caused by them. Change-Id: I666141ff776d52e578f0cad4e00d3ec14e444b42
* rest: use new body validation in creation and update handlerWendy Quarshie2024-04-031-0/+1
| | | | | Bug: T358850 Change-Id: Idce281198604e0983f35776e03d607b7a280cc7e
* Merge "handler: Declare known sources in Validator"jenkins-bot2024-03-281-4/+3
|\
| * handler: Declare known sources in ValidatorAtieno2024-03-281-4/+3
| | | | | | | | | | Bug: T358558 Change-Id: I0536e0d659b53c8f85bf7685beffbb5c5d027998
* | objectcache: Introduce `ObjectCacheFactory` MW serviceDerick Alangi2024-03-191-11/+0
|/ | | | | | | | | | | | | | | | | | | | | ObjectCache is already doing a lot of factory pattern logic like creating instances of the various BagOStuff, this should really be the responsibility of the factory servicet. This patch introduces a proper factory (ObjectCacheFactory) to handle the responsibility of creating various instances of BagOStuff. Since `newFromParams()` is a static function that gets passed in configuration of $wgObjectCaches, that can stay that way (to keep supporting how we do this in prod today). Technical Breaking Change: `ObjectCache::makeLocalServerCache()` now has a parameter and requires it but there are no callers of this method outside MW core hence it is safe to change (and this patch update all callers) to work correctly. Cache prefix is gotten from global state because sometimes at this stage, the services container is not available. Bug: T358346 Change-Id: I3179a387486377c6a575d173f39f82870c49c321
* Merge "ResourceLoader: Add module property skipStructureTest"jenkins-bot2024-03-131-1/+1
|\
| * ResourceLoader: Add module property skipStructureTestTim Starling2024-03-111-1/+1
| | | | | | | | | | | | | | | | | | Allow extensions with very special modules that can't be called in a testing environment to skip ResourcesTest::testRespond(). Needed by If1186797fd047d4f for ext.wikisource.OCR. Change-Id: Id02915d9633c2d8209d2ff2e60f6748095ec10fe
* | Rest: Turn Rest\EntryPoint into a MediaWikiEntryPoint subclassdaniel2024-03-121-4/+4
|/ | | | | | | | The idea is for all entry points to use the MediaWikiEntryPoint base class, to improve consistency and testability. Bug: T354216 Change-Id: I3678afe32c7c1a313d2dcb1808286c25ecd167eb
* Clean up testsMatěj Suchánek2024-02-123-7/+6
| | | | | | | Replace strpos with str_contains, str_starts_with, etc. Fix spelling of "cannot" and other typos. Change-Id: Ie52900b323f46d1978a9dd9ea3b17619b8942160
* Namespace includes/contextJames D. Forrester2024-02-082-0/+3
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Change uses of getDBLoadBalancerFactory() to getConnectionProvider()Bartosz Dziewoński2024-01-221-1/+1
| | | | | | | | | | | | Update cases where one of the IConnectionProvider methods is called immediately. This doesn't really change anything, but I hope it helps promote getConnectionProvider() as the common way to do this. Follow-up to 8604c384f624273f46b653ec252ffaed30e6ff89. Change-Id: Id0e7d02bab0c570343c2b1f03c70b44ee39db112
* tests: Replace usages of wfGetDBAlexander Vorwerk2024-01-181-1/+4
| | | | Change-Id: I4f57ef084da8f0404e7bc2b4c466b7512e89670f
* Update tests for PHPUnit 9.6 (part 1)Daimona Eaytoy2024-01-161-1/+4
| | | | | | | | | - Avoid defining abstract test classes (ending in "Test") - Avoid withConsecutive() - Avoid getMockClass() Bug: T342110 Change-Id: I131e0d85bd14e75aaebd6f212b2e64a45d4c73a2
* ResourceLoader: Drop targets system, deprecated in 1.41James D. Forrester2024-01-121-78/+1
| | | | | | Bug: T340802 Depends-On: Ie936afed7042d5a4713b027c30d7487565a35eaf Change-Id: Icad30d62301be5d7390ebdf34e818519e3fe56c4
* Deprecate and stop using Database::listViews()Tim Starling2023-12-141-0/+21
| | | | | | | | | | | | Follow up Id9ab64fc8b09d9 which made listTables() consistently exclude views. Hard deprecate Database::listViews() which was only used for view filtering of listTables(), conditional on database type. Add an integration test for the new listTables() behaviour. Change-Id: I3402a227f92b35192c6385c6aeab461de43b9f58
* tests: Use namespaced classesUmherirrender2023-12-111-0/+1
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statements and changes to docs done manually Change-Id: Ib326ae1e5c8409a98398c721e8b8ce42c73bd012
* rdbms: Map PostgreSQL boolean values to MySQL-compatible formsTim Starling2023-11-291-0/+21
| | | | | | | | | | | | Also fix callers that were checking for t/f. In CASE and COALESCE expressions, using 't' and 'f' did actually work, because those literals have an unknown type and the other argument is boolean, so PG coerces them to boolean. But it seems safer and clearer to use the strongly typed literals TRUE and FALSE. Bug: T352229 Change-Id: Ia01b76d3d6d2e048feac8e3118d9faff63a9ac56
* Merge "Remove deprecated methods from Content interface"jenkins-bot2023-11-281-11/+0
|\
| * Remove deprecated methods from Content interfacedaniel2023-11-211-11/+0
| | | | | | | | | | | | | | | | | | | | Several methods on the Content interface had been deprecated in 1.35 and 1.36 in favor of corresponding methods on the ContentHandler base class, to allow implementations of these methods to use proper dependency injection. This patch removes backwards compatibility support for subclasses that were overriding these methods. Change-Id: I8e474a1cc4dec760a7f6db25e4b313392f3723b1
* | Follow-up 71ff05267: Stop writing to tablesUsed in tests, now unnecessaryJames D. Forrester2023-11-211-1/+0
|/ | | | | Bug: T342301 Change-Id: I5ea01f7ee103570165261bde0965c5b65e04c369
* ResourceLoader: Remove ResourcesTest::testCommentedLocalFileReferencesTimo Tijhof2023-10-201-16/+0
| | | | | | | | | * Unrelated to the ResourcesTest structure test as it isn't testing any of core's resources. * Moved to the libs/Minify repo in change Ia9018a966a5325d. Change-Id: If87035777633635fe4ad0f01790e7084f56f65a0
* Merge "Structure tests: Alter resources test to also check skinStyles"jenkins-bot2023-10-191-5/+10
|\
| * Structure tests: Alter resources test to also check skinStylesJon Robson2023-10-191-5/+10
| | | | | | | | | | Bug: T348676 Change-Id: I804bda05901e38dc2b0ba12ec954aafcfed3fcbc
* | ApiStructureTest: Improve error messageAmmarpad2023-10-171-2/+2
|/ | | | | | | Make message to actually communicate errors instead of confirming success, this will reduce confusion like in T348934 Change-Id: I0b9cd5aed26be539db429a79c486217a69f74cdb
* Update references to config-vars.phpDannyS7122023-09-231-1/+1
| | | | | | | | Moved to docs/ rather than includes/, update references and remove from phan exclusion list Follow-up: I32c034d05bf2354cdaa5f02d19031421cbae78a1 Change-Id: I8d71c29c8cbfa413db47066f00d71783259f0916
* tests: Migrate more cases to SQBAmir Sarabadani2023-09-211-1/+5
| | | | | Bug: T344971 Change-Id: Ia69d82d6a6e623b9032240dc910fb47ff5887661
* Namespace Config-related classes under \MediaWiki\ConfigJames D. Forrester2023-09-211-0/+1
| | | | | Bug: T166010 Change-Id: I4066885a7ea071d22497abcdb3f95e73e154d08c
* Namespace User under \MediaWiki\UserJames D. Forrester2023-09-191-0/+2
| | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* Reorg: Move WebRequest to includes\RequestAmir Sarabadani2023-09-111-0/+1
| | | | | | | This has been approved as part of RFC T166010 Bug: T321882 Change-Id: I6bbdbbe6ea48cc1f50bc568bb8780fc7c5361a6f
* Merge "Make all limits function as user rights."jenkins-bot2023-09-111-5/+40
|\
| * Make all limits function as user rights.daniel2023-09-111-5/+40
| | | | | | | | | | | | | | | | | | | | | | | | In order to check all existing rate limits through Authority, the limit keys must function as user rights. However, we do not want them to be "normal" permissions, since they cannot sensibly be revoked, and they should not clutter the user interface. To solve this, we introduce the concept of "implicit rights", which are always granted, but limitable. Change-Id: I0ea6f29130da1d68d022d47d9221fe878bc9beae
* | Make MediaWikiIntegrationTestCase::addCoreDBData a noopDaimona Eaytoy2023-09-051-0/+1
|/ | | | | | | | | | | | | The method should never be called directly, so make it throw an exception. Nonetheless, mark it as deprecated and detect overrides in the constructor, so that anyone who tries to override this method will see a warning. Fix the few tests that were relying on the existence of the test page. Bug: T342428 Depends-On: Ic64ded5e2c0b59e7c888ece9566076058a125be4 Change-Id: I308617427309815062d54c14f3438cab31b08a73
* tests: Use namespaced Wikimedia\Rdbms\IDatabaseUmherirrender2023-08-201-1/+1
| | | | | Bug: T344536 Change-Id: I29c80fe2ac3effd5e9df4402c598dc33c1b23d5e
* Do not use UTSysop directly in testsDaimona Eaytoy2023-08-161-2/+2
| | | | | | | | If the test expects the user to exist, it should use getTestSysop to guarantee the account creation. Otherwise, use mocks or different usernames to clarify that the username is not relevant to the test. Change-Id: I87a27f01e1874af410e5d43e2e7fc3b10bb14eb8
* ResourceLoader: wrap module definitions in functionsTim Starling2023-08-111-0/+9
| | | | | | | | This is an intermediate step towards the linked bug, to help untangle the performance impacts. Bug: T343407 Change-Id: I086f173f811fb44683f4a67bf6bc415d7e27f593
* Avoid DB access in non-database testsDaimona Eaytoy2023-08-061-0/+13
| | | | | | | | Mock the needed dependencies to avoid database access when possible, and add the test to the Database group otherwise. Bug: T155147 Change-Id: Ic5c39ab35ab4d993721713285180f072497a5a40
* Avoid DB access in more non-Database testsDaimona Eaytoy2023-08-062-0/+2
| | | | | Bug: T155147 Change-Id: Iae2512c66c32b209ea8579beecb3de94a744da14