dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor adjustments to align with WikimediaUI color palette
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
ResourceLoaderTestCase.php
diff --git
a/tests/phpunit/ResourceLoaderTestCase.php
b/tests/phpunit/ResourceLoaderTestCase.php
index
8eb1fd5
..
45cfdbf
100644
(file)
--- a/
tests/phpunit/ResourceLoaderTestCase.php
+++ b/
tests/phpunit/ResourceLoaderTestCase.php
@@
-1,5
+1,6
@@
<?php
<?php
+use MediaWiki\MediaWikiServices;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
@@
-10,14
+11,23
@@
abstract class ResourceLoaderTestCase extends MediaWikiTestCase {
const BLANK_VERSION = '09p30q0';
/**
const BLANK_VERSION = '09p30q0';
/**
- * @param string $lang
- * @param string $dir
+ * @param array|string $options Language code or options array
+ * - string 'lang' Language code
+ * - string 'dir' Language direction (ltr or rtl)
* @return ResourceLoaderContext
*/
* @return ResourceLoaderContext
*/
- protected function getResourceLoaderContext( $lang = 'en', $dir = 'ltr' ) {
+ protected function getResourceLoaderContext( $options = [] ) {
+ if ( is_string( $options ) ) {
+ // Back-compat for extension tests
+ $options = [ 'lang' => $options ];
+ }
+ $options += [
+ 'lang' => 'en',
+ 'dir' => 'ltr',
+ ];
$resourceLoader = new ResourceLoader();
$request = new FauxRequest( [
$resourceLoader = new ResourceLoader();
$request = new FauxRequest( [
- 'lang' => $
lang
,
+ 'lang' => $
options['lang']
,
'modules' => 'startup',
'only' => 'scripts',
'skin' => 'vector',
'modules' => 'startup',
'only' => 'scripts',
'skin' => 'vector',
@@
-27,7
+37,7
@@
abstract class ResourceLoaderTestCase extends MediaWikiTestCase {
->setConstructorArgs( [ $resourceLoader, $request ] )
->setMethods( [ 'getDirection' ] )
->getMock();
->setConstructorArgs( [ $resourceLoader, $request ] )
->setMethods( [ 'getDirection' ] )
->getMock();
- $ctx->method( 'getDirection' )->willReturn( $
dir
);
+ $ctx->method( 'getDirection' )->willReturn( $
options['dir']
);
return $ctx;
}
return $ctx;
}
@@
-140,7
+150,7
@@
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() );
// 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(
);
$this->setMessageBlobStore( new MessageBlobStore( $this, $this->getLogger() ) );
}
}
$this->setMessageBlobStore( new MessageBlobStore( $this, $this->getLogger() ) );
}
}