Page MenuHomePhabricator

MessageIndexTest fails when run in a suite with SpecialPageFatalTest
Closed, ResolvedPublic

Description

Problem

The Translate's MessageIndexTest class fails if run in a test suite with core's SpecialPageFatalTest before it. 1 test errors with an error:
MessageIndex::storeInterim() must implement interface MessageGroup, null given

Steps to reproduce
In a Mediawiki checkout with the Wikibase extension installed.

  1. Copy phpunit.dist.xml to phpunit.xml
  2. Add a test suite with the following three tests:
<testsuite name="failing_group">
   <file>tests/phpunit/structure/SpecialPageFatalTest.php</file>
   <file>extensions/Translate/tests/phpunit/MessageLoading/MessageIndexTest.php</file>
</testsuite>
  1. Run the named test suite:
mw docker mediawiki exec -- composer run phpunit:entrypoint -- --testsuite failing_group

Observed behaviour
The test run fails:

> phpunit '--cache-result-file' '/workspace/log/.phpunit_group_2_database.cache.json' '--testsuite' 'split_group_2' '--group' 'Database' '--exclude-group' 'Broken,ParserFuzz,Stub,Standalone'
Using PHP 7.4.33
Running with MediaWiki settings because there might be integration tests
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

...............................................................  63 / 273 ( 23%)
............................................................... 126 / 273 ( 46%)
............................................................... 189 / 273 ( 69%)
............................................................... 252 / 273 ( 92%)
...................E.                                           273 / 273 (100%)

Time: 00:08.610, Memory: 323.85 MB

There was 1 error:

1) MediaWiki\Extension\Translate\MessageLoading\MessageIndexTest::testInterimCache
TypeError: Argument 1 passed to MediaWiki\Extension\Translate\MessageLoading\MessageIndex::storeInterim() must implement interface MessageGroup, null given, called in /workspace/src/extensions/Translate/tests/phpunit/MessageLoading/MessageIndexTest.php on line 202

/workspace/src/extensions/Translate/src/MessageLoading/MessageIndex.php:292
/workspace/src/extensions/Translate/tests/phpunit/MessageLoading/MessageIndexTest.php:202

Expected Behaviour
The tests should pass.

Event Timeline

Change #1053903 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Translate@master] Clear process cache in MessageIndexTest

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

Change #1053903 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Clear process cache in MessageIndexTest

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