Page MenuHomePhabricator

HEAD of WikiLambda extension now fails its tests; "Bad value for parameter $config: Parameters cannot be null unless all are omitted" from Language.php
Closed, ResolvedPublic

Description

00:01:48.430 1) MediaWiki\Extension\WikiLambda\Tests\Integration\ZMultiLingualStringSetTest::testCreation
00:01:48.430 Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $config: Parameters cannot be null unless all are omitted
00:01:48.430 
00:01:48.430 /workspace/src/vendor/wikimedia/assert/src/Assert.php:72
00:01:48.430 /workspace/src/includes/language/Language.php:465
00:01:48.430 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/WikiLambdaIntegrationTestCase.php:137
00:01:48.430 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/ZMultiLingualStringSetTest.php:75
00:01:48.430 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:457
00:01:48.430 === Logs generated by test case
00:01:48.430 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
00:01:48.430 [localisation] [debug] LocalisationCache using store LCStoreNull []
00:01:48.430 ===
00:01:48.430 
00:01:48.430 2) MediaWiki\Extension\WikiLambda\Tests\Integration\ZMultiLingualStringSetTest::testModification
00:01:48.430 Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $config: Parameters cannot be null unless all are omitted
00:01:48.430 
00:01:48.430 /workspace/src/vendor/wikimedia/assert/src/Assert.php:72
00:01:48.430 /workspace/src/includes/language/Language.php:465
00:01:48.430 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/WikiLambdaIntegrationTestCase.php:137
00:01:48.430 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/ZMultiLingualStringSetTest.php:155
00:01:48.430 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:457
00:01:48.430 === Logs generated by test case
00:01:48.430 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
00:01:48.430 [localisation] [debug] LocalisationCache using store LCStoreNull []
00:01:48.430 ===
00:01:48.430 
00:01:48.430 3) MediaWiki\Extension\WikiLambda\Tests\Integration\ZMultiLingualStringSetTest::testPersistentCreation
00:01:48.430 Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $config: Parameters cannot be null unless all are omitted
00:01:48.431 
00:01:48.431 /workspace/src/vendor/wikimedia/assert/src/Assert.php:72
00:01:48.431 /workspace/src/includes/language/Language.php:465
00:01:48.431 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/WikiLambdaIntegrationTestCase.php:137
00:01:48.431 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/ZMultiLingualStringSetTest.php:203
00:01:48.431 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:457
00:01:48.431 === Logs generated by test case
00:01:48.431 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
00:01:48.431 [localisation] [debug] LocalisationCache using store LCStoreNull []
00:01:48.431 ===
00:01:48.431 
00:01:48.431 4) MediaWiki\Extension\WikiLambda\Tests\Integration\ZMultiLingualStringTest::testCreation
00:01:48.431 Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $config: Parameters cannot be null unless all are omitted
00:01:48.431 
00:01:48.431 /workspace/src/vendor/wikimedia/assert/src/Assert.php:72
00:01:48.431 /workspace/src/includes/language/Language.php:465
00:01:48.431 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/WikiLambdaIntegrationTestCase.php:137
00:01:48.431 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/ZMultiLingualStringTest.php:71
00:01:48.431 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:457
00:01:48.431 === Logs generated by test case
00:01:48.431 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
00:01:48.431 [localisation] [debug] LocalisationCache using store LCStoreNull []
00:01:48.431 ===
00:01:48.431 
00:01:48.431 5) MediaWiki\Extension\WikiLambda\Tests\Integration\ZMultiLingualStringTest::testModification
00:01:48.431 Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $config: Parameters cannot be null unless all are omitted
00:01:48.431 
00:01:48.431 /workspace/src/vendor/wikimedia/assert/src/Assert.php:72
00:01:48.431 /workspace/src/includes/language/Language.php:465
00:01:48.431 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/WikiLambdaIntegrationTestCase.php:137
00:01:48.431 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/ZMultiLingualStringTest.php:152
00:01:48.431 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:457
00:01:48.431 === Logs generated by test case
00:01:48.431 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
00:01:48.431 [localisation] [debug] LocalisationCache using store LCStoreNull []
00:01:48.431 ===
00:01:48.431 
00:01:48.431 6) MediaWiki\Extension\WikiLambda\Tests\Integration\ZMultiLingualStringTest::testPersistentCreation
00:01:48.431 Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $config: Parameters cannot be null unless all are omitted
00:01:48.432 
00:01:48.432 /workspace/src/vendor/wikimedia/assert/src/Assert.php:72
00:01:48.432 /workspace/src/includes/language/Language.php:465
00:01:48.432 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/WikiLambdaIntegrationTestCase.php:137
00:01:48.432 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/ZMultiLingualStringTest.php:210
00:01:48.432 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:457
00:01:48.432 === Logs generated by test case
00:01:48.432 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
00:01:48.432 [localisation] [debug] LocalisationCache using store LCStoreNull []
00:01:48.432 ===
00:01:48.432 
00:01:48.432 7) MediaWiki\Extension\WikiLambda\Tests\Integration\ZTypeTest::testPersistentCreation
00:01:48.432 Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $config: Parameters cannot be null unless all are omitted
00:01:48.432 
00:01:48.432 /workspace/src/vendor/wikimedia/assert/src/Assert.php:72
00:01:48.432 /workspace/src/includes/language/Language.php:465
00:01:48.432 /workspace/src/extensions/WikiLambda/tests/phpunit/integration/ZTypeTest.php:47
00:01:48.432 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:457
00:01:48.432 === Logs generated by test case
00:01:48.432 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
00:01:48.432 [localisation] [debug] LocalisationCache using store LCStoreNull []
00:01:48.432 ===
00:01:48.432 
00:01:48.432 ERRORS!
00:01:48.432 Tests: 5551, Assertions: 20670, Errors: 7, Skipped: 1.

Event Timeline

Language.php itself hasn't changed in nearly a year (rMW845094fe3d51: Language: retrieve MainConfig instead of using a bunch of globals); MediaWikiIntegrationTestCase.php's only recent change was rMW7ee3bc9334fc: Improve ensureMockDatabaseConnection() error message which doesn't seem relevant?

Aha, git bisect shows that this was caused by rMW845094fe3d51: Language: retrieve MainConfig instead of using a bunch of globals. I'll see if we should revert.

Language::__construct() is documented as

@internal Calling this directly is deprecated. Use LanguageFactory instead.

so if changes to it broke WikiLambda's tests I don't think that warrants a revert. Just pass the config in the tests

Change 770945 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/WikiLambda@master] WikiLambdaIntegrationTestCase: pass config to language constructor

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

Change 771450 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] WikiLambdaIntegrationTestCase::makeLanguage: Use LanguageFactory instead of rolling our own

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

Change 771450 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] WikiLambdaIntegrationTestCase::makeLanguage: Use LanguageFactory when we can

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

Change 770945 abandoned by Jforrester:

[mediawiki/extensions/WikiLambda@master] tests: pass config to language constructor

Reason:

I stole some of these ideas for my own patch, thank you!

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