From afffa55567633fcd604adcc3d654f03d76986671 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 24 Jun 2018 02:59:44 +0100 Subject: [PATCH] resourceloader: Add coverage for StartupModule::getDefinitionSummary Change-Id: I913c8ecd5f51db851ef408c4281cdd75a0e0b239 --- .../ResourceLoaderStartUpModuleTest.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php index 698370463a..810d1fee62 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php @@ -561,4 +561,32 @@ mw.loader.register( [ ); } + /** + * @covers ResourceLoaderStartupModule::getDefinitionSummary + */ + public function testGetVersionHash_varyConfig() { + $context = $this->getResourceLoaderContext(); + + $this->setMwGlobals( 'wgArticlePath', '/w1' ); + $module = new ResourceLoaderStartupModule(); + $version1 = $module->getVersionHash( $context ); + $module = new ResourceLoaderStartupModule(); + $version2 = $module->getVersionHash( $context ); + $this->setMwGlobals( 'wgArticlePath', '/w3' ); + $module = new ResourceLoaderStartupModule(); + $version3 = $module->getVersionHash( $context ); + + $this->assertEquals( + $version1, + $version2, + 'Deterministic version hash' + ); + + $this->assertNotEquals( + $version1, + $version3, + 'Config change impacts version hash' + ); + } + } -- 2.20.1