aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/unit/includes/Rest/CorsUtilsTest.php
Commit message (Collapse)AuthorAgeFilesLines
* tests: Add more use statements in namespaced classesReedy2024-02-181-1/+2
| | | | Change-Id: I2629cfcb09fde6f18be824779a2c12c013ea0cb5
* Tests: Fix CorsUtils testAmmarpad2023-10-031-1/+1
| | | | | | | Without using the variable value, any domain added will pass the trusted origin check Change-Id: I5cdbdcef546fb04c9db80fde2214607c5b2ef32f
* Bump codesniffer to 42.0.0Amir Sarabadani2023-09-271-1/+1
| | | | | | Most noisily, this enables MediaWiki.Arrays.OneSpaceInlineArray. Change-Id: I8ab11399c67ce7e3ab1b6249b591452774393428
* Fix even more PHPStorm inspections (#3)Tim Starling2023-03-251-1/+1
| | | | | | | | | | | | | | | * Inappropriate @inheritDoc usage. Arguably all @inheritDoc is inappropriate but these are the ones PHPStorm flags as misleading due to the method not being inherited. * Doc comment type does not match actual argument/return type. * I replaced "@return void|never" with "@return void" since never means never, it doesn't make sense for it to be conditional. If a method can return (even if that is unlikely) then @return contains the type that it returns. "@return never" means that there is no such type because the method never returns. * Incomplete/partial/broken doc tags Change-Id: Ide86bd6d2b44387f37d234c2b059d6fbc42ec962
* tests: Make some PHPUnit data providers staticTim Starling2023-03-241-3/+3
| | | | | | | | | | | | | Just methods where adding "static" to the declaration was enough, I didn't do anything with providers that used $this. Initially by search and replace. There were many mistakes which I found mostly by running the PHPStorm inspection which searches for $this usage in a static method. Later I used the PHPStorm "make static" action which avoids the more obvious mistakes. Bug: T332865 Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
* unit tests: Use MainConfigNames constant to refer configsUmherirrender2022-08-171-13/+14
| | | | | | | When creating ServiceOptions objects or fake HashConfigs use the constant to refer the config name Change-Id: I59a29f25b76e896c07e82156c6cc4494f98e64cc
* Fix incomplete test case in CorsUtilsTestThiemo Kreuz2022-08-061-16/+10
| | | | | | | | | There was never anything actually executed in this test. This patch also removes a little bit of unused code and inlines trivial test setup code. Change-Id: I7dd019cac383313913e06adbea22bb6540162280
* Tests: Cleanup some unnecessary nested function callsReedy2022-06-061-16/+16
| | | | | | Replace ->will( ->return with ->willReturn( Change-Id: Ia2dfafa03cac8169d86d6fa5a30b73bfad1fe9fa
* Make REST CORS allowed headers respect site configuration.Petr Pchelko2021-05-301-0/+23
| | | | | Bug: T268791 Change-Id: I4f10e508730baf5ce276bb71dc354554eed3cfb0
* Use UserIdentityValue in tests where possibleThiemo Kreuz2021-04-221-16/+8
| | | | | | | … instead of PHPUnit mocks. The tiny value class is made for this. Change-Id: Ie04cde57126fcafabf8906f9644c6e80345d8a48
* tests: Remove @param docs from test code that just repeat the signatureThiemo Kreuz2021-01-211-6/+0
| | | | | | | | | | | | | | These are not only 100% identical to the actual code, but also: * It's error-prone. Some are already wrong. * These test…() functions are not meant to be called from anywhere. What is the target audience for this documentation? * There is a @dataProvider. What such @param tags actually do is document the provider, but in an odd place. Just looking at the provider should give the same information. * The MediaWiki CodeSniffer allows to skip @param when there is a @dataProvider, for the reasone listed. Change-Id: I0f6f42f9a15776df944a0da48a50f9d5a2fb6349
* Improve some function documentation in testsUmherirrender2021-01-141-1/+2
| | | | | | Also fix some whitespaces Change-Id: Ibed50a4f07442d3f299cf545c16f5dbb5f27a411
* Handle CORS preflight request and prevent anon users from unsafe methodsDavid Barratt2020-09-211-0/+320
Creates an OPTIONS handler that handles any OPTIONS requests that are not already handled by a handler. CORS has no mechanism to ensure the user is authenticated, so the Router will reject cross-origin requests from anon users. This change allows authenticated users to make cross-origin requests if they authenticate with OAuth or if $wgRestAllowCrossOriginCookieAuth is enabled. Bug: T232176 Bug: T262712 Change-Id: I128b4bdbec4f6bea35142153c951fd7b79617106