resourceloader: Add coverage for StartupModule::getDefinitionSummary
authorTimo Tijhof <krinklemail@gmail.com>
Sun, 24 Jun 2018 01:59:44 +0000 (02:59 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Sun, 24 Jun 2018 01:59:44 +0000 (02:59 +0100)
Change-Id: I913c8ecd5f51db851ef408c4281cdd75a0e0b239

tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php

index 6983704..810d1fe 100644 (file)
@@ -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'
+               );
+       }
+
 }