Page MenuHomePhabricator

PostCollectionTest.php fails when run in a suite with SpecialPageFatalTest.php
Closed, ResolvedPublic

Description

Problem

The PostCollectionTest class fails if run in a test suite with SpecialPageFatalTest before it. 2 tests fail with errors. Running the classes individually causes no problems.

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

  1. Copy phpunit.dist.xml to phpunit.xml
  2. Add a test suite with the following two tests:
<testsuite name="failing_group">
   <file>tests/phpunit/structure/SpecialPageFatalTest.php</file>
   <file>extensions/Flow/tests/phpunit/Collection/PostCollectionTest.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:

$ mw docker mediawiki exec -- composer run phpunit:entrypoint -- --testsuite failing_group
> phpunit '--testsuite' 'failing_group'
Using PHP 8.1.18
Running with MediaWiki settings because there might be integration tests
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

..EE.....                                                           9 / 9 (100%)

Time: 00:15.221, Memory: 121.00 MB

There were 2 errors:

1) Flow\Tests\Collection\PostCollectionTest::testGetCollection
Wikimedia\Services\ContainerDisabledException: Container disabled!

/var/www/html/w/vendor/wikimedia/services/src/ServiceContainer.php:403
...
===

2) Flow\Tests\Collection\PostCollectionTest::testNewFromId
Wikimedia\Services\ContainerDisabledException: Container disabled!

/var/www/html/w/vendor/wikimedia/services/src/ServiceContainer.php:403
...
===

ERRORS!
Tests: 9, Assertions: 187, Errors: 2.

Expected Behaviour
The tests should pass.

Event Timeline

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

[mediawiki/extensions/Flow@master] Reset Hooks in testcase setup

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

Change #1049849 merged by jenkins-bot:

[mediawiki/extensions/Flow@master] Reset Hooks in testcase setup

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