Page MenuHomePhabricator

Flow\Tests\Formatter\RevisionFormatterTest PHPUnit tests fail when run as single class
Closed, ResolvedPublic

Description

Problem

Running the Flow PHPUnit test suite as a complete suite works normally in, for example, mwdocker and CI environments:

mw docker mediawiki exec MW_DB=wikidatawikidev composer run phpunit:entrypoint -- extensions/Flow/tests/phpunit

but running the RevisionFormatterTest on its own fails with two errors:

$ mw docker mediawiki exec MW_DB=wikidatawikidev composer run phpunit:entrypoint -- extensions/Flow/tests/phpunit/Formatter/RevisionFormatterTest.php
> phpunit 'extensions/Flow/tests/phpunit/Formatter/RevisionFormatterTest.php'
Using PHP 8.1.18
Running with MediaWiki settings because there might be integration tests
PHPUnit 9.6.16 by Sebastian Bergmann and contributors.

......................EE..                                        26 / 26 (100%)

Time: 00:01.456, Memory: 74.50 MB

There were 2 errors:

1) Flow\Tests\Formatter\RevisionFormatterTest::testMockFormatterBasicallyWorks
Wikimedia\Services\ContainerDisabledException: Container disabled!

...

2) Flow\Tests\Formatter\RevisionFormatterTest::testFormattingEditedTitle
Wikimedia\Services\ContainerDisabledException: Container disabled!
...

This appears to be related to singleton service references and lifecycle management for the MediaWikiServices container.

Acceptance Criteria

  • The RevisionFormatterTest class passes when run on its own
  • The Flow PHPUnit test suite continues to pass

Event Timeline

I've been having a look at this because I'm playing around with CI and splitting the PHPUnit extensions test suite into smaller chunks (see T361190)

Change #1024330 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Flow@master] Make RevisionFormatterTest run standalone

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

The change in T363448 appears to have resolved this issue. I can no longer reproduce it locally.

Change #1024330 abandoned by Arthur taylor:

[mediawiki/extensions/Flow@master] Make RevisionFormatterTest run standalone

Reason:

Already addressed in 1024453

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

ArthurTaylor removed ArthurTaylor as the assignee of this task.

Change #1024330 restored by Arthur taylor:

[mediawiki/extensions/Flow@master] Make RevisionFormatterTest run standalone

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

Was a bit premature with my previous comment - this patch appears to be necessary even in the presence of https://gerrit.wikimedia.org/r/1024330 . Proposing my patch again here.

ArthurTaylor changed the task status from In Progress to Open.Apr 30 2024, 12:04 PM

Change #1024330 merged by jenkins-bot:

[mediawiki/extensions/Flow@master] Make RevisionFormatterTest run standalone

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