Page MenuHomePhabricator

Optimize phpunit tests in ReadingLists
Closed, ResolvedPublic2 Estimated Story Points

Description

Background

Especially now that ReadingLists is included as part of the gate and submit test job, we should ensure that the tests run fast. The phpunit tests include a large amount of integration tests and tests that use the database.

We should remove redundant cleanup, create fixtures only when needed, and try to avoid using the database when possible.

NOTE: This task is timeboxed to no more than 2 story points of time and effort. There can be further optimizations later, as needed.

Requirements

Acceptance criteria

Optimizations may include, but not limited to:

  • Tests no longer call the ReadingLists teardown API or REST handler only to clean up database state that MediaWikiIntegrationTestCase already resets.
  • Remove unnecessary test fixtures.
  • Tests that use MediaWiki services but do not access storage are not marked @group Database.
  • Tests still pass and cover the functionality of the ReadingLists extension (creating/managing lists, reading list items, the REST and action APIs, bookmark button etc)

This task was created by Version 1.1.0 of the Reader Experience team task template using phabulous.

Event Timeline

Change #1328640 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Split ReadingLists API test helpers into separate trait

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

Change #1328705 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Populate test data only when needed in ApiQueryReadingListEntriesTest

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

Change #1329263 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Remove @group Database from tests that do not need the DB

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

Change #1329275 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Move hook handler tests that do not need DB to unit tests

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

Change #1329281 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Cache project IDs in ReadingListsTestHelperTrait

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

Change #1329283 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Avoid redundant list size queries in ReadingListsTestHelperTrait

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

Change #1329301 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Reduce repeated test setup in ApiQueryReadingListEntriesTest

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

aude updated the task description. (Show Details)

Change #1328705 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] Populate test data only when needed in ApiQueryReadingListEntriesTest

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

Change #1329281 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] Cache project IDs in ReadingListsTestHelperTrait

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

aude triaged this task as Medium priority.Aug 27 2026, 9:21 PM

Change #1329263 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] Remove @group Database from tests that do not need the DB

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

Change #1329283 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] Avoid redundant list size queries in ReadingListsTestHelperTrait

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

Change #1328640 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] tests: Split ReadingLists API test helpers into separate trait

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

Change #1329301 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] tests: Reduce repeated test setup in ApiQueryReadingListEntriesTest

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

Change #1329275 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] tests: Move hook handler tests that do not need DB to unit tests

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

Jdlrobson-WMF set the point value for this task to 2.Mon, Oct 5, 5:54 PM