Page MenuHomePhabricator

ConfigHelperTest.php and MinervaPagePermissionsTest.php fail when run in a suite with SpecialListDatatypesTest.php
Closed, ResolvedPublic

Description

Problem

The ConfigHelperTest and MinervaPagePermissionsTest classes generate failures if run in a test suite with SpecialListDatatypesTest before it. 3 tests fail. Running the classes individually causes no problems.

Steps to reproduce
In a Mediawiki checkout with Wikibase, Vector and Minerva installed.

  1. Copy phpunit.dist.xml to phpunit.xml
  2. Add a test suite with the following two tests:
 <testsuite name="failing_group">
   <file>extensions/Wikibase/repo/tests/phpunit/includes/Specials/SpecialListDatatypesTest.php</file>
   <file>skins/Vector/tests/phpunit/integration/ConfigHelperTest.php</file>
   <file>skins/MinervaNeue/tests/phpunit/permissions/MinervaPagePermissionsTest.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 -- MW_DB=wikidatawikidev composer run --timeout=0 phpunit:entrypoint -- --testsuite new_bad --exclude-group Database,Broken,ParserFuzz,Stub,Standalone
> phpunit '--testsuite' 'new_bad' '--exclude-group' 'Database,Broken,ParserFuzz,Stub,Standalone'
Using PHP 8.1.18
Running with MediaWiki settings because there might be integration tests
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

...F.F.......F.................                                   31 / 31 (100%)

Time: 00:01.252, Memory: 58.50 MB

There were 3 failures:

1) MediaWiki\Skins\Vector\Tests\Integration\ConfigHelperTest::testShouldDisableMainPage with data set #0 (true)
Failed asserting that true is identical to false.

/var/www/html/w/skins/Vector/tests/phpunit/integration/ConfigHelperTest.php:37
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"HashBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
===

2) MediaWiki\Skins\Vector\Tests\Integration\ConfigHelperTest::testShouldDisableMainPageImplicit
Failed asserting that true is false.

/var/www/html/w/skins/Vector/tests/phpunit/integration/ConfigHelperTest.php:48
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"HashBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
===

3) MediaWiki\Minerva\MinervaPagePermissionsTest::testWatchAndEditNotAllowedOnMainPage
Failed asserting that true is false.

/var/www/html/w/skins/MinervaNeue/tests/phpunit/permissions/MinervaPagePermissionsTest.php:89
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"HashBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[MessageCache] [debug] MessageCache using store {class} {"class":"HashBagOStuff"}
[wfDebug] [debug] ParserFactory: using default preprocessor {"private":false}
[localisation] [debug] LocalisationCache::isExpired(en): cache missing, need to make one []
[objectcache] [debug] MainObjectStash using store {class} {"class":"HashBagOStuff"}
===

FAILURES!
Tests: 31, Assertions: 67, Failures: 3.

Expected Behaviour
The tests should pass.

Event Timeline

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

[mediawiki/extensions/Wikibase@master] Remove deprecated unnecessary setContentLang call

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

This looks like an almost identical failure to the failure in T368369. I think it might make sense at least for the Minerva tests to set the content language in test setup if we're going to make assertions about localised page names.

Change #1054364 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] SpecialListDatatypesTest: Clean up test setup

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

Change #1054364 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] SpecialListDatatypesTest: Clean up test setup

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

Change #1053305 abandoned by Arthur taylor:

[mediawiki/extensions/Wikibase@master] Remove deprecated unnecessary setContentLang call

Reason:

Fixed in Ifdb41fa58b

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