From: Timo Tijhof Date: Fri, 28 Mar 2014 00:58:03 +0000 (-0700) Subject: resourceloader: Add unit test to ensure absence of illegal dependencies X-Git-Tag: 1.31.0-rc.0~16306^2 X-Git-Url: http://git.cyclocoop.org/%22%20%20.%20generer_url_ecrire%28%22mots_tous%22%29%20.%20%22?a=commitdiff_plain;h=330444a4f91d7b5dc1416eddb4035e95ac711fdf;p=lhc%2Fweb%2Fwiklou.git resourceloader: Add unit test to ensure absence of illegal dependencies Loading these can cause side-effects and is just redundant in general. Change-Id: Ic8b4ed45d4d42172a456cc5eaf314c41e4e6fd18 --- diff --git a/resources/Resources.php b/resources/Resources.php index 00251efaa4..642897c577 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -373,7 +373,6 @@ return array( 'resources/src/jquery.ui-themes/vector/jquery.ui.theme.css', ), ), - 'dependencies' => 'jquery', 'group' => 'jquery.ui', ), 'jquery.ui.widget' => array( @@ -572,7 +571,6 @@ return array( // Effects 'jquery.effects.core' => array( 'scripts' => 'resources/lib/jquery.effects/jquery.effects.core.js', - 'dependencies' => 'jquery', 'group' => 'jquery.ui', ), 'jquery.effects.blind' => array( diff --git a/tests/phpunit/structure/ResourcesTest.php b/tests/phpunit/structure/ResourcesTest.php index cce1b7ecfb..cfcc771486 100644 --- a/tests/phpunit/structure/ResourcesTest.php +++ b/tests/phpunit/structure/ResourcesTest.php @@ -34,6 +34,21 @@ class ResourcesTest extends MediaWikiTestCase { $this->assertTrue( strpos( $cssText, '@media' ) === false, 'Stylesheets should not both specify "media" and contain @media' ); } + public function testDependencies() { + $data = self::getAllModules(); + $illegalDeps = array( 'jquery', 'mediawiki' ); + + foreach ( $data['modules'] as $moduleName => $module ) { + foreach ( $illegalDeps as $illegalDep ) { + $this->assertNotContains( + $illegalDep, + $module->getDependencies(), + "Module '$moduleName' must not depend on '$illegalDep'" + ); + } + } + } + /** * Get all registered modules from ResouceLoader. */ diff --git a/tests/qunit/QUnitTestResources.php b/tests/qunit/QUnitTestResources.php index 607c4352b0..74ea58ee18 100644 --- a/tests/qunit/QUnitTestResources.php +++ b/tests/qunit/QUnitTestResources.php @@ -94,7 +94,6 @@ return array( 'jquery.tabIndex', 'jquery.tablesorter', 'jquery.textSelection', - 'mediawiki', 'mediawiki.api', 'mediawiki.api.parse', 'mediawiki.api.watch',