X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FResourceLoaderTestCase.php;h=68b91bf3a419e14afc3fe080acc232a3027d4fc1;hb=2e79c5c6164a8d64f7ad5fe847f2de8512ab119f;hp=8eb1fd509a689dd1c84f765878d7bcf6bd2b7f32;hpb=01aebfce884aa0dd347b7f97c27969167a737df9;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/ResourceLoaderTestCase.php b/tests/phpunit/ResourceLoaderTestCase.php index 8eb1fd509a..68b91bf3a4 100644 --- a/tests/phpunit/ResourceLoaderTestCase.php +++ b/tests/phpunit/ResourceLoaderTestCase.php @@ -1,5 +1,6 @@ $options ]; + } + $options += [ + 'lang' => 'en', + 'dir' => 'ltr', + 'modules' => 'startup', + 'only' => 'scripts', + ]; + $resourceLoader = $rl ?: new ResourceLoader(); $request = new FauxRequest( [ - 'lang' => $lang, - 'modules' => 'startup', - 'only' => 'scripts', + 'lang' => $options['lang'], + 'modules' => $options['modules'], + 'only' => $options['only'], 'skin' => 'vector', 'target' => 'phpunit', ] ); @@ -27,7 +42,7 @@ abstract class ResourceLoaderTestCase extends MediaWikiTestCase { ->setConstructorArgs( [ $resourceLoader, $request ] ) ->setMethods( [ 'getDirection' ] ) ->getMock(); - $ctx->method( 'getDirection' )->willReturn( $dir ); + $ctx->method( 'getDirection' )->willReturn( $options['dir'] ); return $ctx; } @@ -140,7 +155,13 @@ class EmptyResourceLoader extends ResourceLoader { // and default registrations are done from ServiceWiring instead. public function __construct( Config $config = null, LoggerInterface $logger = null ) { $this->setLogger( $logger ?: new NullLogger() ); - $this->config = $config ?: ConfigFactory::getDefaultInstance()->makeConfig( 'main' ); + $this->config = $config ?: MediaWikiServices::getInstance()->getMainConfig(); + // Source "local" is required by StartupModule + $this->addSource( 'local', $this->config->get( 'LoadScript' ) ); $this->setMessageBlobStore( new MessageBlobStore( $this, $this->getLogger() ) ); } + + public function getErrors() { + return $this->errors; + } }