From 315ac38cd6f5d3f467b893669967ac20c391c61e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 7 Jun 2011 17:56:40 +0000 Subject: [PATCH] Added phpunit test cases for r87497, r88076: ResourceLoader module name prefix collapsing --- tests/phpunit/includes/ResourceLoaderTest.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/phpunit/includes/ResourceLoaderTest.php b/tests/phpunit/includes/ResourceLoaderTest.php index 76f0ba874c..30a69c5e2c 100644 --- a/tests/phpunit/includes/ResourceLoaderTest.php +++ b/tests/phpunit/includes/ResourceLoaderTest.php @@ -46,6 +46,40 @@ class ResourceLoaderTest extends PHPUnit_Framework_TestCase { $resourceLoader->register( $name, $module ); $this->assertEquals( $module, $resourceLoader->getModule( $name ) ); } + + /** + * @dataProvider providePackedModules + */ + public function testMakePackedModulesString( $desc, $modules, $packed ) { + $this->assertEquals( $packed, ResourceLoader::makePackedModulesString( $modules ), $desc ); + } + + /** + * @dataProvider providePackedModules + */ + public function testexpandModuleNames( $desc, $modules, $packed ) { + $this->assertEquals( $modules, ResourceLoaderContext::expandModuleNames( $packed ), $desc ); + } + + public function providePackedModules() { + return array( + array( + 'Example from makePackedModulesString doc comment', + array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' ), + 'foo.bar,baz|bar.baz,quux', + ), + array( + 'Example from expandModuleNames doc comment', + array( 'jquery.foo', 'jquery.bar', 'jquery.ui.baz', 'jquery.ui.quux' ), + 'jquery.foo,bar|jquery.ui.baz,quux', + ), + array( + 'Regression fixed in r88706 with dotless names', + array( 'foo', 'bar', 'baz' ), + 'foo,bar,baz', + ) + ); + } } /* Stubs */ -- 2.20.1