wiki.techinc.nl/tests/phpunit/unit/includes/Rest
Kosta Harlan 774ba90fbb
HandlerTestTrait: Always mock validateParams and validateBody
Why:

- An empty array is a valid return value for the method, and...
- Without this, tests that use `executeHandler()` with an empty
  parameters array (for example, the REST endpoint has no query
  parameters) and items in the body params array will result in a
  `getValidatedParams() called before validate()` exception in
  `getValidatedParams`, because the Handler's `validatedParams` property
  will be null instead of an empty array

What:

- Remove the truthiness check for query and body params, and always set
  the array (empty or otherwise) as the return value for
  `validateParams` and `validateBody`

Change-Id: I9cf36775b7392734b184b63023beef4a2a8434ac
2023-09-05 16:33:12 +02:00
..
BasicAccess tests: Make some PHPUnit data providers static 2023-03-24 02:53:57 +00:00
Handler HandlerTestTrait: Always mock validateParams and validateBody 2023-09-05 16:33:12 +02:00
HeaderParser tests: Make some PHPUnit data providers static 2023-03-24 02:53:57 +00:00
PathTemplateMatcher
Validator Merge "Rest: ensure there are no extraneous params in JSON bodies" 2023-08-25 09:11:33 +00:00
ConditionalHeaderUtilTest.php ConditionalHeaderUtil: Handle If-None-Match: * 2022-10-07 09:06:04 +00:00
CorsUtilsTest.php Fix even more PHPStorm inspections (#3) 2023-03-25 00:30:15 +00:00
HeaderContainerTest.php Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
ResponseFactoryTest.php tests: Make some PHPUnit data providers static 2023-03-24 02:53:57 +00:00
RestTestTrait.php Make it possible to override the session in REST API tests 2023-02-06 18:56:51 +01:00
RouterTest.php tests: Make some PHPUnit data providers static 2023-03-24 02:53:57 +00:00
SessionHelperTestTrait.php tests: Remove unused argument to createMock 2023-05-23 20:58:37 +02:00
StringStreamTest.php tests: Swap assertion order in unit tests 2021-08-04 20:21:01 +02:00
testAdditionalRoutes.json Add config variable $wgRestAPIAdditionalRouteFiles 2020-03-23 10:22:58 -05:00
testRoutes.json REST: gracefully handle all exceptions. 2021-11-02 20:33:13 +01:00
TokenAwareHandlerTraitTest.php tests: Make some PHPUnit data providers static 2023-03-24 02:53:57 +00:00