From: Timo Tijhof Date: Tue, 3 Oct 2017 17:10:02 +0000 (+0100) Subject: phpunit: Include all raw modules in detection of illegal dependencies X-Git-Tag: 1.31.0-rc.0~1896 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=d4a17a10a5f6a9f9b0f2a2ff934ccdd6690e7440;p=lhc%2Fweb%2Fwiklou.git phpunit: Include all raw modules in detection of illegal dependencies * Use getStartupModules() instead of hardcoding these two module names. * Also collect any other module that is registered with raw=>true. Change-Id: I5f75cc8f99b90f58d76b7e87f068f50f9f608ed0 --- diff --git a/tests/phpunit/structure/ResourcesTest.php b/tests/phpunit/structure/ResourcesTest.php index 2fba76b688..d31779d0ba 100644 --- a/tests/phpunit/structure/ResourcesTest.php +++ b/tests/phpunit/structure/ResourcesTest.php @@ -44,15 +44,24 @@ class ResourcesTest extends MediaWikiTestCase { } /** - * Verify that nothing explicitly depends on the 'jquery' and 'mediawiki' modules. - * They are always loaded, depending on them is unsupported and leads to unexpected behaviour. + * Verify that nothing explicitly depends on base modules, or other raw modules. + * + * Depending on them is unsupported as they are not registered client-side by the startup module. + * * TODO Modules can dynamically choose dependencies based on context. This method does not * test such dependencies. The same goes for testMissingDependencies() and * testUnsatisfiableDependencies(). */ public function testIllegalDependencies() { $data = self::getAllModules(); - $illegalDeps = [ 'jquery', 'mediawiki' ]; + + $illegalDeps = ResourceLoaderStartupModule::getStartupModules(); + foreach ( $data['modules'] as $moduleName => $module ) { + if ( $module->isRaw() ) { + $illegalDeps[] = $moduleName; + } + } + $illegalDeps = array_unique( $illegalDeps ); /** @var ResourceLoaderModule $module */ foreach ( $data['modules'] as $moduleName => $module ) {