From 39a00e2ea0dde5a67b065178295d3f9cc614e2c1 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 15 Mar 2016 03:11:55 +0000 Subject: [PATCH] resourceloader: Add structure unit test to confirm messages exist Bug: T129976 Change-Id: I5333523efe3e7b9191e871d67d9eb650002c7784 --- tests/phpunit/structure/ResourcesTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/phpunit/structure/ResourcesTest.php b/tests/phpunit/structure/ResourcesTest.php index 6446416109..86ce53f339 100644 --- a/tests/phpunit/structure/ResourcesTest.php +++ b/tests/phpunit/structure/ResourcesTest.php @@ -86,6 +86,25 @@ class ResourcesTest extends MediaWikiTestCase { } } + /** + * Verify that all specified messages actually exist. + */ + public function testMissingMessages() { + $data = self::getAllModules(); + $validDeps = array_keys( $data['modules'] ); + $lang = Language::factory( 'en' ); + + /** @var ResourceLoaderModule $module */ + foreach ( $data['modules'] as $moduleName => $module ) { + foreach ( $module->getMessages() as $msgKey ) { + $this->assertTrue( + wfMessage( $msgKey )->useDatabase( false )->inLanguage( $lang )->exists(), + "Message '$msgKey' required by '$moduleName' must exist" + ); + } + } + } + /** * Verify that all dependencies of all modules are always satisfiable with the 'targets' defined * for the involved modules. -- 2.20.1