Page MenuHomePhabricator

MediaWiki core unit tests should be true unit tests (tracking)
Open, LowPublic

Description

Some of the "unit" tests we have in MediaWiki require things like databases to be set up and data imported. That's not a unit test.

Those are still valuable tests (probably) they just shouldn't be run during our unittest run (which should be as fast as possible).

Event Timeline

greg created this task.Dec 18 2014, 11:48 PM
greg raised the priority of this task from to Low.
greg updated the task description. (Show Details)
greg added a project: MediaWiki-Core-Testing.
greg changed Security from none to None.
greg added subscribers: greg, hashar.
Krinkle added a subscriber: Krinkle.Apr 3 2015, 8:44 PM

Related: T89432: Make PHPUnit tests run without installing MediaWiki.

Some limited interaction with the database is appropriate, but only for testing the Database class itself I guess.

If/when that module becomes its own library, we can take it for granted within MediaWiki. At which point we shouldn't need any database in MediaWiki unit tests at all. Instead, we'd mock value objects not the underlying database.

Krinkle moved this task from Inbox to PHPUnit on the MediaWiki-Core-Testing board.Jul 7 2017, 5:17 AM
Krinkle removed a subscriber: Krinkle.Mar 3 2018, 1:25 AM

Change 513106 had a related patch set uploaded (by TK-999; owner: TK-999):
[mediawiki/core@master] [WIP/PoC]: Separate MediaWiki unit and integration tests

https://gerrit.wikimedia.org/r/513106

Change 513106 merged by Jforrester:
[mediawiki/core@master] Separate MediaWiki unit and integration tests

https://gerrit.wikimedia.org/r/513106

Change 517550 had a related patch set uploaded (by TK-999; owner: TK-999):
[mediawiki/core@master] Introduce separate unit tests PHPUnit configuration

https://gerrit.wikimedia.org/r/517550

Change 517550 merged by jenkins-bot:
[mediawiki/core@master] Introduce separate unit tests PHPUnit configuration

https://gerrit.wikimedia.org/r/517550

Change 517701 had a related patch set uploaded (by TK-999; owner: TK-999):
[mediawiki/core@master] Move trivially compatible tests to the unit tests suite

https://gerrit.wikimedia.org/r/517701

Change 519165 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/core@master] Unit tests: prevent access to global functions and variables

https://gerrit.wikimedia.org/r/519165

Change 519165 merged by jenkins-bot:
[mediawiki/core@master] Define unit and integration test suites

https://gerrit.wikimedia.org/r/519165

Change 517701 merged by jenkins-bot:
[mediawiki/core@master] Move trivially compatible tests to the unit tests suite

https://gerrit.wikimedia.org/r/517701

Izno added a subscriber: Izno.Jul 2 2019, 1:12 PM