X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2FResourceLoaderTestCase.php;h=f75cc2294cb61a409cfbf22b754a533d5f99a110;hp=68b91bf3a419e14afc3fe080acc232a3027d4fc1;hb=956c2430c7b8fceb289aaeacc8d6c2e0def2c56e;hpb=41f1ce0d35b929d480ce87605a3234c187e44fd2 diff --git a/tests/phpunit/ResourceLoaderTestCase.php b/tests/phpunit/ResourceLoaderTestCase.php index 68b91bf3a4..f75cc2294c 100644 --- a/tests/phpunit/ResourceLoaderTestCase.php +++ b/tests/phpunit/ResourceLoaderTestCase.php @@ -27,6 +27,7 @@ abstract class ResourceLoaderTestCase extends MediaWikiTestCase { $options += [ 'lang' => 'en', 'dir' => 'ltr', + 'skin' => 'vector', 'modules' => 'startup', 'only' => 'scripts', ]; @@ -35,7 +36,7 @@ abstract class ResourceLoaderTestCase extends MediaWikiTestCase { 'lang' => $options['lang'], 'modules' => $options['modules'], 'only' => $options['only'], - 'skin' => 'vector', + 'skin' => $options['skin'], 'target' => 'phpunit', ] ); $ctx = $this->getMockBuilder( 'ResourceLoaderContext' ) @@ -93,6 +94,7 @@ class ResourceLoaderTestModule extends ResourceLoaderModule { protected $isKnownEmpty = false; protected $type = ResourceLoaderModule::LOAD_GENERAL; protected $targets = [ 'phpunit' ]; + protected $shouldEmbed = null; public function __construct( $options = [] ) { foreach ( $options as $key => $value ) { @@ -142,11 +144,31 @@ class ResourceLoaderTestModule extends ResourceLoaderModule { return $this->isKnownEmpty; } + public function shouldEmbedModule( ResourceLoaderContext $context ) { + return $this->shouldEmbed !== null ? $this->shouldEmbed : parent::shouldEmbedModule( $context ); + } + public function enableModuleContentVersion() { return true; } } +class ResourceLoaderFileTestModule extends ResourceLoaderFileModule { + protected $lessVars = []; + + public function __construct( $options = [], $test = [] ) { + parent::__construct( $options ); + + foreach ( $test as $key => $value ) { + $this->$key = $value; + } + } + + public function getLessVars( ResourceLoaderContext $context ) { + return $this->lessVars; + } +} + class ResourceLoaderFileModuleTestModule extends ResourceLoaderFileModule { }