From fe5170d32b3833f848b2da760183d52ac65040bf Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 21 Oct 2014 22:32:13 -0700 Subject: [PATCH] Move tests into separate ResourceLoaderFileModuleTest Change-Id: I2504867850b7e6bda2afb8c4fedbe6b8819bc15b --- .../ResourceLoaderFileModuleTest.php | 61 +++++++++++++++++++ .../ResourceLoaderModuleTest.php | 59 ------------------ 2 files changed, 61 insertions(+), 59 deletions(-) create mode 100644 tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php new file mode 100644 index 0000000000..fb436ee3b8 --- /dev/null +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php @@ -0,0 +1,61 @@ +register( + 'fakeskin', + 'FakeSkin', + function () { + } + ); + } + + /** + * @covers ResourceLoaderFileModule::getAllSkinStyleFiles + */ + public function testGetAllSkinStyleFiles() { + $baseParams = array( + 'scripts' => array( + 'foo.js', + 'bar.js', + ), + 'styles' => array( + 'foo.css', + 'bar.css' => array( 'media' => 'print' ), + 'screen.less' => array( 'media' => 'screen' ), + 'screen-query.css' => array( 'media' => 'screen and (min-width: 400px)' ), + ), + 'skinStyles' => array( + 'default' => 'quux-fallback.less', + 'fakeskin' => array( + 'baz-vector.css', + 'quux-vector.less', + ), + ), + 'messages' => array( + 'hello', + 'world', + ), + ); + + $module = new ResourceLoaderFileModule( $baseParams ); + + $this->assertEquals( + array( + 'foo.css', + 'baz-vector.css', + 'quux-vector.less', + 'quux-fallback.less', + 'bar.css', + 'screen.less', + 'screen-query.css', + ), + array_map( 'basename', $module->getAllStyleFiles() ) + ); + } +} diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php index b0edaaf7b7..b25e9b061a 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php @@ -2,65 +2,6 @@ class ResourceLoaderModuleTest extends ResourceLoaderTestCase { - protected function setUp() { - parent::setUp(); - - // The return value of the closure shouldn't matter since this test should - // never call it - SkinFactory::getDefaultInstance()->register( - 'fakeskin', - 'FakeSkin', - function () { - } - ); - } - - /** - * @covers ResourceLoaderFileModule::getAllSkinStyleFiles - */ - public function testGetAllSkinStyleFiles() { - $context = self::getResourceLoaderContext(); - - $baseParams = array( - 'scripts' => array( - 'foo.js', - 'bar.js', - ), - 'styles' => array( - 'foo.css', - 'bar.css' => array( 'media' => 'print' ), - 'screen.less' => array( 'media' => 'screen' ), - 'screen-query.css' => array( 'media' => 'screen and (min-width: 400px)' ), - ), - 'skinStyles' => array( - 'default' => 'quux-fallback.less', - 'fakeskin' => array( - 'baz-vector.css', - 'quux-vector.less', - ), - ), - 'messages' => array( - 'hello', - 'world', - ), - ); - - $module = new ResourceLoaderFileModule( $baseParams ); - - $this->assertEquals( - array( - 'foo.css', - 'baz-vector.css', - 'quux-vector.less', - 'quux-fallback.less', - 'bar.css', - 'screen.less', - 'screen-query.css', - ), - array_map( 'basename', $module->getAllStyleFiles() ) - ); - } - /** * @covers ResourceLoaderModule::getDefinitionSummary * @covers ResourceLoaderFileModule::getDefinitionSummary -- 2.20.1