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).

Related Objects

Event Timeline

greg raised the priority of this task from to Low.
greg updated the task description. (Show Details)
greg added a project: MediaWiki-Core-Tests.
greg changed Security from none to None.
greg added subscribers: greg, hashar.

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.

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

Didn't know this task existed
I've been working to switch core tests from integration to unit where possible, open patches at https://gerrit.wikimedia.org/r/q/topic:%22unit-tests%22+status:open