Page MenuHomePhabricator

Babel tests fail when CommunityConfiguration is not present
Open, LowPublic

Description

MediaWiki-extensions-Babel does not require CommunityConfiguration in `extension.json. Running the PHPUnit tests fail though:

16:16:37 1) Babel\Tests\Unit\ConfigWrapperTest::testReturnsArray
16:16:37 PHPUnit\Framework\MockObject\UnknownTypeException: Class or interface "MediaWiki\Extension\CommunityConfiguration\Access\MediaWikiConfigRouter" does not exist
16:16:37 
16:16:37 /workspace/src/tests/phpunit/MediaWikiTestCaseTrait.php:63
16:16:37 /workspace/src/extensions/Babel/tests/phpunit/unit/ConfigWrapperTest.php:15
16:16:37
16:16:37 2) Babel\Tests\Unit\ConfigWrapperTest::testRelaysHas
16:16:37 PHPUnit\Framework\MockObject\UnknownTypeException: Class or interface "MediaWiki\Extension\CommunityConfiguration\Access\MediaWikiConfigRouter" does not exist
16:16:37 
16:16:37 /workspace/src/tests/phpunit/MediaWikiTestCaseTrait.php:63
16:16:37 /workspace/src/extensions/Babel/tests/phpunit/unit/ConfigWrapperTest.php:29
16:16:37

Those tests should be skipped when CommunityConfiguration is not present with markTestSkippedIfExtensionNotLoaded( 'CommunityConfiguration' )

Note tests/phpunit/integration/maintenance/MigrateConfigToCommunityTest.php extends MediaWiki\Extension\CommunityConfiguration\Tests\SchemaProviderTestCase so I don't think we can make it skippable.

See also T410117: ReportIncident PHPUnit tests fail when CommunityConfiguration is not present

Event Timeline

@Urbanecm_WMF and I talked about this task.

I have experimented with a new job (T407797) that does not get dependencies injected from zuul/dependencies.yaml and instead clones extensions mentioned in the requires field of extension.json.

Since #babel does not have any requirement mentioned beside MediaWiki:

extension.json
{
    "name": "Babel",
    "requires": {
        "MediaWiki": ">= 1.43.0"
    },

That new job does not clone CommunityConfiguration, nor does it have to since Babel supposedly should work without CommunityConfiguration. The test fails solely because the structure class is not available in this context.

I filed this task as a reminder to find a way to skip those tests somehow (extensions implementing tests with an optional Scribunto face a similar issue). Essentially it can be ignored by the Growth-Team, I will reach out when I start tackling this topic again ;)

Note: in zuul/dependencies.yaml, Babel depends on CommunityConfiguration, that is used by the CI jobs and the structured tests are properly run. This is not going to change and I think address the concerns raised in subtask T412861.

Thanks for the summary @hashar! I linked it on T412861 (which is an umbrella task linking all "CC structure test" issues together). Let us know if there is anything we can do to help moving this forward.