Commit graph

13 commits

Author SHA1 Message Date
Alexander Vorwerk
9b09bf3112 Use updated ObjectFactory namespace
Depends-On: I99c5e5664d2401c36a9890f148eba7c25e6e8324
Depends-On: I48ab818b2965da14af15ef370aa83ad9455badd9
Depends-On: I018371e4b77911e56152ca7b2df734afc73f58a5
Change-Id: I04ebdb52102f6191d49a9cc70b1f98308299e72f
2022-03-09 23:04:51 +00:00
DannyS712
32a37154f1 Move ApiWatchlistTraitTest back to unit tests
All dependencies are once again injected

Change-Id: I0c7d45fcb8d451a92dcf438a076a24cf231827d8
2021-07-06 20:37:45 +00:00
DannyS712
b73bbd3a92 Inject AuthManager into some api classes
- ApiAMCreateAccount
- ApiClientLogin
- ApiChangeAuthenticationData
- ApiLinkAccount
- ApiLogin
- ApiRemoveAuthenticationData

Now that ApiLogin needs services injected,
update ApiModuleManagerTest to use ApiRsd
as the example api module that doesn't need
any services.

Bug: T259960
Change-Id: If78457f1d859d3d575f2016ef4b212263473cea6
2021-05-29 00:32:05 +00:00
Petr Pchelko
f86e82a5a7 Remove ApiUnblock unit test.
The class already has decent coverage with integration tests,
and I couldn't find anything the unit test provides in addition.
The unit tests is trying to mock the world, which locks the
implementation in place - any attempt to change internals of
the API module breaks the test.

Change-Id: I3eabd089faab04710828a0bba37f112721f9f888
2021-04-27 13:37:13 -07:00
Thiemo Kreuz
c1ee8250e9 Remove unnecessary ->equalTo() from tests
This is the default anyway when using ->with(). The test code
becomes so much more readable without this, I would like to
argue. Let it just say "with these values".

Because of the way I split my changes into multiple patches
there are a few other changes in this patch I could not split,
e.g. removing unnecessary ->any(). This is the default anyway
and doesn't make the test more specific.

Change-Id: I34990799fa9258ba8dc64c7e78ec43f7903b7681
2021-04-23 12:02:42 +02:00
Cindy Cicalese
b242d49a62 Use WatchlistManager in API classes
Change-Id: I7b2016162e86b455c0102742751981c44d7e829c
2021-04-21 04:41:06 +00:00
Daimona Eaytoy
535d7abf59 phpunit: Mass-replace setMethods with onlyMethods and adjust
Ended up using
  grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g'

special-casing setMethods( null ) -> onlyMethods( [] )

and then manual fix of failing test (from PS2 onwards).

Bug: T278010
Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
2021-04-16 20:15:00 +02:00
jenkins-bot
245bb6234f Merge "Make ApiWatchlistTraitTest a pure unit test" 2021-03-01 10:09:27 +00:00
DannyS712
63f0f3a30f ApiUnblockTest: fix file location
Should have been under /includes/api

Change-Id: Id2a61d1f8724fd4de0afd86dadb5fbd69e1819fc
2021-02-27 00:54:12 +00:00
DannyS712
63363c2509 Make ApiWatchlistTraitTest a pure unit test
We can use mocks :)

Change-Id: Ic0ca07191598e22741a14bb7f0d8f08fe4c98e41
2021-02-26 22:58:28 +00:00
DannyS712
bab2c0099c Make ApiModuleManagerTest a pure unit test
Switch test case with services to use a
service other than ObjectFactory, to make
it easier to mock.

Change-Id: I374a516b6bcc8111b2432245faf935f8287d45a7
2021-02-26 22:41:46 +00:00
Legoktm
4e35134f7a Revert "Separate MediaWiki unit and integration tests"
This reverts commit 0a2b996278.

Reason for revert: Broke postgres tests.

Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
2019-06-13 23:00:08 +00:00
Máté Szabó
0a2b996278 Separate MediaWiki unit and integration tests
This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.

The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.

You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml

Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
2019-06-13 22:56:31 +02:00