mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-12-24 12:43:04 +00:00
01f6a6c34e
Bug: T278278 Change-Id: I49b57e68079c998419e235b1727eea8c121c234b
26 lines
646 B
PHP
26 lines
646 B
PHP
<?php
|
|
|
|
use MediaWiki\Extension\Gadgets\Gadget;
|
|
use MediaWiki\Extension\Gadgets\GadgetResourceLoaderModule;
|
|
use MediaWiki\Extension\Gadgets\MediaWikiGadgetsDefinitionRepo;
|
|
use Wikimedia\TestingAccessWrapper;
|
|
|
|
class GadgetTestUtils {
|
|
/**
|
|
* @param string $line
|
|
* @return Gadget
|
|
*/
|
|
public static function makeGadget( $line ) {
|
|
$repo = new MediaWikiGadgetsDefinitionRepo();
|
|
return $repo->newFromDefinition( $line, 'misc' );
|
|
}
|
|
|
|
public static function makeGadgetModule( Gadget $g ) {
|
|
$module = TestingAccessWrapper::newFromObject(
|
|
new GadgetResourceLoaderModule( [ 'id' => null ] )
|
|
);
|
|
$module->gadget = $g;
|
|
return $module;
|
|
}
|
|
}
|