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