Adds a new "structure" PHPUnit test, "CodexMessageDefinitionTest.php". This test exists to ensure that every message in the Codex message keys file (produced by the library during build and updated for each Codex release) is defined in the en.json and qqq.json message files for Codex in MediaWiki. Bug: T371330 Change-Id: I01f0888d13122d587bef17043eec46c32e8f534e
24 lines
915 B
PHP
24 lines
915 B
PHP
<?php
|
|
/**
|
|
* Ensures that all message keys defined by Codex exist in MediaWiki's i18n files.
|
|
*
|
|
* @coversNothing
|
|
*/
|
|
class CodexMessageDefinitionTest extends MediaWikiIntegrationTestCase {
|
|
|
|
public function testThatMessagesExist() {
|
|
$resourcesPath = __DIR__ . '/../../../resources';
|
|
$languagesPath = __DIR__ . '/../../../languages';
|
|
$messageKeys = json_decode( file_get_contents( "$resourcesPath/lib/codex/messageKeys.json" ), true );
|
|
$qqq = json_decode( file_get_contents( "$languagesPath/i18n/codex/qqq.json" ), true );
|
|
$en = json_decode( file_get_contents( "$languagesPath/i18n/codex/en.json" ), true );
|
|
|
|
foreach ( $messageKeys as $key ) {
|
|
$this->assertArrayHasKey( $key, $qqq, "$key must be defined in $languagesPath/i18n/codex/qqq.json" );
|
|
}
|
|
|
|
foreach ( $messageKeys as $key ) {
|
|
$this->assertArrayHasKey( $key, $en, "$key must be defined in $languagesPath/i18n/codex/en.json" );
|
|
}
|
|
}
|
|
}
|