2 class SVGTest
extends MediaWikiTestCase
{
4 protected function setUp() {
7 $this->filePath
= __DIR__
. '/../../data/media/';
9 $this->setMwGlobals( 'wgShowEXIF', true );
11 $this->backend
= new FSFileBackend( array(
12 'name' => 'localtesting',
13 'lockManager' => 'nullLockManager',
14 'containerPaths' => array( 'data' => $this->filePath
)
16 $this->repo
= new FSRepo( array(
18 'url' => 'http://localhost/thumbtest',
19 'backend' => $this->backend
22 $this->handler
= new SVGHandler
;
26 * @param $filename String
27 * @param $expected Array The expected independent metadata
28 * @dataProvider providerGetIndependentMetaArray
29 * @covers SvgHandler::getCommonMetaArray
31 public function testGetIndependentMetaArray( $filename, $expected ) {
32 $file = $this->dataFile( $filename, 'image/svg+xml' );
33 $res = $this->handler
->getCommonMetaArray( $file );
35 $this->assertEquals( $res, $expected );
38 public function providerGetIndependentMetaArray() {
40 array( 'Tux.svg', array(
41 'ObjectName' => 'Tux',
42 'ImageDescription' => 'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
44 array( 'Wikimedia-logo.svg', array() )
48 private function dataFile( $name, $type ) {
49 return new UnregisteredLocalFile( false, $this->repo
,
50 "mwstore://localtesting/data/$name", $type );