Isolate globals for ContentSecurityPolicy tests
authorAntoine Musso <hashar@free.fr>
Thu, 13 Jun 2019 10:29:49 +0000 (12:29 +0200)
committerAntoine Musso <hashar@free.fr>
Thu, 13 Jun 2019 10:35:33 +0000 (12:35 +0200)
commit629c43e91b903726befd83dd3c88fa1c5ab2d096
tree13e5943d4f298759a97a28529d0a83bbe5b8829a
parentbd1d2b8529501d00080c534e245479747a097604
Isolate globals for ContentSecurityPolicy tests

With "$wgResourceBasePath = '/';", various ContentSecurityPolicy tests
failed due to unexpected output. An extra "extensions" is added in the
output line.

The reason is getAdditionalSelfUrls() injecting URls from a few global
settings but the test fails to set them in setUp(). The settings are:

  $wgLoadScript
  $wgExtensionAssetsPath
  $wgStylePath
  $wgResourceBasePath

Set them explicitly in setUp() so the test outcome does not depend on
values that might have been set in LocalSettings.php.

Add a quick test to ensure getAdditionalSelfUrls() does recognize
domains in those four global settings.

Change-Id: Ia0dc2f44c71bdf89a0ee9ef82d9cb6a1cbd8a9da
tests/phpunit/includes/ContentSecurityPolicyTest.php