$options = ResourceLoaderImageModuleTest::$commonImageData[$name];
$fileDescriptor = is_string( $options ) ? $options : $options['file'];
$allowedVariants = is_array( $options ) &&
- isset( $options['variants'] ) ? $options['variants'] : array();
- $variants = array_fill_keys( $allowedVariants, array( 'color' => 'red' ) );
+ isset( $options['variants'] ) ? $options['variants'] : [];
+ $variants = array_fill_keys( $allowedVariants, [ 'color' => 'red' ] );
return new ResourceLoaderImageTestable(
$name,
'test',
}
public static function provideGetPath() {
- return array(
- array( 'add', 'en', 'add.gif' ),
- array( 'add', 'he', 'add.gif' ),
- array( 'remove', 'en', 'remove.svg' ),
- array( 'remove', 'he', 'remove.svg' ),
- array( 'next', 'en', 'next.svg' ),
- array( 'next', 'he', 'prev.svg' ),
- array( 'help', 'en', 'help-ltr.svg' ),
- array( 'help', 'ar', 'help-rtl.svg' ),
- array( 'help', 'he', 'help-ltr.svg' ),
- array( 'bold', 'en', 'bold-b.svg' ),
- array( 'bold', 'de', 'bold-f.svg' ),
- array( 'bold', 'ar', 'bold-f.svg' ),
- array( 'bold', 'fr', 'bold-a.svg' ),
- array( 'bold', 'he', 'bold-a.svg' ),
- );
+ return [
+ [ 'add', 'en', 'add.gif' ],
+ [ 'add', 'he', 'add.gif' ],
+ [ 'remove', 'en', 'remove.svg' ],
+ [ 'remove', 'he', 'remove.svg' ],
+ [ 'next', 'en', 'next.svg' ],
+ [ 'next', 'he', 'prev.svg' ],
+ [ 'help', 'en', 'help-ltr.svg' ],
+ [ 'help', 'ar', 'help-rtl.svg' ],
+ [ 'help', 'he', 'help-ltr.svg' ],
+ [ 'bold', 'en', 'bold-b.svg' ],
+ [ 'bold', 'de', 'bold-f.svg' ],
+ [ 'bold', 'ar', 'bold-f.svg' ],
+ [ 'bold', 'fr', 'bold-a.svg' ],
+ [ 'bold', 'he', 'bold-a.svg' ],
+ ];
}
/**
* @dataProvider provideGetPath
*/
public function testGetPath( $imageName, $languageCode, $path ) {
- static $dirMap = array(
+ static $dirMap = [
'en' => 'ltr',
'de' => 'ltr',
'fr' => 'ltr',
'he' => 'rtl',
'ar' => 'rtl',
- );
- static $contexts = array();
+ ];
+ static $contexts = [];
$image = $this->getTestImage( $imageName );
- $context = $this->getResourceLoaderContext( $languageCode, $dirMap[$languageCode] );
+ $context = $this->getResourceLoaderContext( [
+ 'lang' => $languageCode,
+ 'dir' => $dirMap[$languageCode],
+ ] );
$this->assertEquals( $image->getPath( $context ), $this->imagesPath . '/' . $path );
}
* @covers ResourceLoaderImage::massageSvgPathdata
*/
public function testGetImageData() {
- $context = $this->getResourceLoaderContext( 'en', 'ltr' );
+ $context = $this->getResourceLoaderContext();
$image = $this->getTestImage( 'remove' );
$data = file_get_contents( $this->imagesPath . '/remove.svg' );