Page MenuHomePhabricator

light Integration tests without DB
Closed, InvalidPublic

Description

Motivation

Integration Tests are too slow for development: TDD or refactoring, Docker env, prepare DB for each run
It makes development slow.

In fact, some integration tests don't need a database but are not pure unit tests. It's the usual situation for SOLID / GRASP development or refactoring. We needed in ServiceContainer, global configs, legacy support

We can split integration tests into a light and full. Traits or class extensions can be used to DRY.

proof of concept: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/568491/1/tests/phpunit/includes/content/ObjectFactoryMakeContentHandlerWithSpecsToTest.php


We can also prepare MediaWikiService for easy use in unit tests.
Change return of method: MediaWikiService::foceGlobalInstance to void

Event Timeline

Aklapper added a subscriber: daniel.

Removing task assignee due to inactivity, as this open task has been assigned for more than two years. See the email sent to the task assignee on February 06th 2022 (and T295729).

Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome.

If this task has been resolved in the meantime, or should not be worked on ("declined"), please update its task status via "Add Action… 🡒 Change Status".

Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.

Daimona subscribed.

We already have databaseless integration tests; this is controlled by the @group Database class annotation. (Note that at the moment we still setup a fake DB for databaseless tests, but it will no longer be the case after T155147)