3 class SvgTest
extends MediaWikiTestCase
{
5 protected function setUp() {
8 $this->filePath
= __DIR__
. '/../../data/media/';
10 $this->setMwGlobals( 'wgShowEXIF', true );
12 $this->backend
= new FSFileBackend( array(
13 'name' => 'localtesting',
14 'wikiId' => wfWikiId(),
15 'containerPaths' => array( 'data' => $this->filePath
)
17 $this->repo
= new FSRepo( array(
19 'url' => 'http://localhost/thumbtest',
20 'backend' => $this->backend
23 $this->handler
= new SvgHandler
;
27 * @param string $filename
28 * @param array $expected The expected independent metadata
29 * @dataProvider providerGetIndependentMetaArray
30 * @covers SvgHandler::getCommonMetaArray
32 public function testGetIndependentMetaArray( $filename, $expected ) {
33 $file = $this->dataFile( $filename, 'image/svg+xml' );
34 $res = $this->handler
->getCommonMetaArray( $file );
36 $this->assertEquals( $res, $expected );
39 public function providerGetIndependentMetaArray() {
41 array( 'Tux.svg', array(
42 'ObjectName' => 'Tux',
44 'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
46 array( 'Wikimedia-logo.svg', array() )
50 private function dataFile( $name, $type ) {
51 return new UnregisteredLocalFile( false, $this->repo
,
52 "mwstore://localtesting/data/$name", $type );