Commit graph

19 commits

Author SHA1 Message Date
Reedy
85396a9c99 tests: Fix @covers and @coversDefaultClass to have leading \
Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
2024-02-16 22:43:56 +00:00
James D. Forrester
4bae64d1c7 Namespace includes/context
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
2024-02-08 11:07:01 -05:00
James D. Forrester
83d72bc108 API: Replace deprecated calls to wfExpandUrl with UrlUtils::expand
Bug: T319340
Change-Id: Ic987f9381ac17e9e46504abdb2d07a5a94ba3b4a
2023-06-22 16:49:01 -04:00
Tim Starling
0077c5da15 Use short array destructuring instead of list()
Introduced in PHP 7.1. Because it's shorter and looks nice.

I used regex replacement.

Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
2022-10-21 15:33:37 +11:00
Thiemo Kreuz
61ae7504df Replace trivial usa of mock builder with createMock() shortcut
createMock() does the same, but is much easier to read.

A small difference is that some of the replacements made in this
patch didn't use disableOriginalConstructor() before. In case this
was relevant we should see the respective test fail. If not we can
save some CPU cycles and skip these constructors.

Change-Id: Ib98fb06e0fe753b7a53cb087a47e1159515a8ad5
2022-07-15 16:43:48 +00:00
jenkins-bot
8bc27513e3 Merge "api: Replace numerous deprecated constants" 2022-06-06 01:10:54 +00:00
Reedy
41c42d5435 Tests: Cleanup some unnecessary nested function calls
Replace ->will( ->return with ->willReturn(

Change-Id: Ia2dfafa03cac8169d86d6fa5a30b73bfad1fe9fa
2022-06-06 01:02:34 +01:00
Reedy
0b5084f868 api: Replace numerous deprecated constants
Change-Id: I34ffcb70efbfa257da8dab6e0790aa0d697caf5b
2022-06-06 00:18:50 +01:00
DannyS712
27d9452f6d Inject dependencies into SearchApi
Used in api classes where services can be injected,
no need to rely on MediaWikiServices

Will make it possible to convert ApiOpenSearchTest to
a unit test, since everything is injected, but that will be
done in a follow-up

Plus some minor cleanup to SearchApi

Change-Id: If0a3a60f1ead897947143b57d98a3a506387f6d5
2021-07-04 10:58:36 +00:00
Umherirrender
1d8fdc20fa api: Inject services into ApiOpenSearch
Bug: T259960
Change-Id: Iaf834da5aad020fbfc2850ff786b23c134717a01
2021-06-29 20:26:58 +00:00
Thiemo Kreuz
b95a07380a Remove meaningless ->expects( $this->any() ) from all tests
It is not entirely meaningless. It might be an indicator that
the number of calls to a method is intentionally unlimited.
This is similar to e.g. an @inheritDoc PHPDoc comment that
marks a method as being "intentionally undocumented".

However, what's the meaning of being "intentionally
unconstrained"? Let's just not have any constraint then.

I feel all these ->expects( $this->any() ) bloat the test
code so much that it's never worth it.

Change-Id: I9925e7706bd03e1666f6eb0b284cb42b0dd3be23
2021-04-23 11:58:58 +02:00
Thiemo Kreuz
40764d277c Replace PHPUnit ->returnValue() with ->willReturn() shortcut
It's the same and makes the test code much more readable, I
would like to argue.

Because of the was I split all the changes I made into smaller
patches this patch contains some other changes in the same
lines where I could not split them off. E.g. removal of
->any(), which is the default anyway and doesn't do anything.

Change-Id: Ib297b989d4aec33b31a4e33fe9d5032865b39be0
2021-04-22 10:37:45 +02:00
addshore
959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
Kunal Mehta
2c2dc593d2 Add @covers tags API tests without them
Change-Id: Ida0f954cb0a44719af3a3d0c6bda4587c9ca42b6
2017-12-27 17:50:06 +00:00
Thiemo Mättig
3e83a50213 Remove unused imports from test classes
Validating this should be as simple as it can be: if the tests run,
this change should be fine. :-)

Change-Id: I8e4a3dfc83fdc9b8c8d7f5bbd067e088ebd2133d
2017-01-10 11:49:58 +01:00
dcausse
16e2491a73 Pass User to SearchEngine::getProfiles
Useful for search engines that allow users to customize search profiles.

Depends-On: Icd577c8ebc6e162befe30bde4fe276e633d2e434
Change-Id: I471cd090730d2a25cb70d622ec3bebbe9583118c
2016-09-20 20:22:23 +00:00
Erik Bernhardson
1b13cc1236 Rename OpenSearch qiprofile parameter back to profile
In I6f987db this parameter was inadvertantly renamed to qiprofile. The
qiprofile is something different, and is also a BC break. The BC break is
pretty minor, for a randomly chosen day this looks to be used 157 times
out of 28.7M requests, but since this really isn't a qiprofile rename
it back to what it was.

Change-Id: I1cc07945888c15ea4b4c9596eea447b706606fae
2016-07-28 10:25:33 -07:00
Erik Bernhardson
5da2c4197d Push common search api parameters into SearchApi class
We have a number of parameters that are pretty much the same between
these different search api's. Lets make them actually the same by
sharing the definitions, and then letting individual classes tweak them
as needed by removing the offset, or adjusting the max limits as
necessary.

Change-Id: I6f987db8ecb63dc943b4d2518bfe3703c677448e
2016-07-26 08:56:00 -07:00