X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=tests%2Fphpunit%2FResourceLoaderTestCase.php;h=45cfdbfc612d35f6e3636e1d510072969f115a6d;hb=652e555d26cc49bc98464a3c06116de3aa45140f;hp=baa481e51c61becffd636db0c3d82d0ba8bcdce1;hpb=f8eb417ac29e07fd2b1d4bbbc619f07629c0db07;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/ResourceLoaderTestCase.php b/tests/phpunit/ResourceLoaderTestCase.php index baa481e51c..45cfdbfc61 100644 --- a/tests/phpunit/ResourceLoaderTestCase.php +++ b/tests/phpunit/ResourceLoaderTestCase.php @@ -11,14 +11,23 @@ abstract class ResourceLoaderTestCase extends MediaWikiTestCase { 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 */ - 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( [ - 'lang' => $lang, + 'lang' => $options['lang'], 'modules' => 'startup', 'only' => 'scripts', 'skin' => 'vector', @@ -28,7 +37,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; }