Index: trunk/phase3/tests/phpunit/includes/ResourceLoaderTest.php |
— | — | @@ -46,6 +46,40 @@ |
47 | 47 | $resourceLoader->register( $name, $module ); |
48 | 48 | $this->assertEquals( $module, $resourceLoader->getModule( $name ) ); |
49 | 49 | } |
| 50 | + |
| 51 | + /** |
| 52 | + * @dataProvider providePackedModules |
| 53 | + */ |
| 54 | + public function testMakePackedModulesString( $desc, $modules, $packed ) { |
| 55 | + $this->assertEquals( $packed, ResourceLoader::makePackedModulesString( $modules ), $desc ); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * @dataProvider providePackedModules |
| 60 | + */ |
| 61 | + public function testexpandModuleNames( $desc, $modules, $packed ) { |
| 62 | + $this->assertEquals( $modules, ResourceLoaderContext::expandModuleNames( $packed ), $desc ); |
| 63 | + } |
| 64 | + |
| 65 | + public function providePackedModules() { |
| 66 | + return array( |
| 67 | + array( |
| 68 | + 'Example from makePackedModulesString doc comment', |
| 69 | + array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' ), |
| 70 | + 'foo.bar,baz|bar.baz,quux', |
| 71 | + ), |
| 72 | + array( |
| 73 | + 'Example from expandModuleNames doc comment', |
| 74 | + array( 'jquery.foo', 'jquery.bar', 'jquery.ui.baz', 'jquery.ui.quux' ), |
| 75 | + 'jquery.foo,bar|jquery.ui.baz,quux', |
| 76 | + ), |
| 77 | + array( |
| 78 | + 'Regression fixed in r88706 with dotless names', |
| 79 | + array( 'foo', 'bar', 'baz' ), |
| 80 | + 'foo,bar,baz', |
| 81 | + ) |
| 82 | + ); |
| 83 | + } |
50 | 84 | } |
51 | 85 | |
52 | 86 | /* Stubs */ |