X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FResourceLoaderTestCase.php;h=2a21351f41cd8f4b1184f49ffb20404695a102fd;hb=0fdb213fe56e2ca73e29450c904e90291abba293;hp=64693b0dc50b7d229774fd63ddc0cd2b9a2a1ca4;hpb=67d483e74c27eac2e094fd169e3f1e0e820d664e;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/ResourceLoaderTestCase.php b/tests/phpunit/ResourceLoaderTestCase.php index 64693b0dc5..2a21351f41 100644 --- a/tests/phpunit/ResourceLoaderTestCase.php +++ b/tests/phpunit/ResourceLoaderTestCase.php @@ -101,6 +101,7 @@ class ResourceLoaderTestModule extends ResourceLoaderModule { protected $type = ResourceLoaderModule::LOAD_GENERAL; protected $targets = [ 'phpunit' ]; protected $shouldEmbed = null; + protected $mayValidateScript = false; public function __construct( $options = [] ) { foreach ( $options as $key => $value ) { @@ -109,7 +110,14 @@ class ResourceLoaderTestModule extends ResourceLoaderModule { } public function getScript( ResourceLoaderContext $context ) { - return $this->validateScriptFile( 'input', $this->script ); + if ( $this->mayValidateScript ) { + // This enables the validation check that replaces invalid + // scripts with a warning message. + // Based on $wgResourceLoaderValidateJS + return $this->validateScriptFile( 'input', $this->script ); + } else { + return $this->script; + } } public function getStyles( ResourceLoaderContext $context ) {