Merge "Revert "Make it possible to install extensions using Composer""
[mediawiki.git] / tests / phpunit / includes / media / SVGTest.php
blob8a3d527c845098c8717a08b858590253c6303e67
1 <?php
3 class SvgTest extends MediaWikiTestCase {
5 protected function setUp() {
6 parent::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 )
16 ) );
17 $this->repo = new FSRepo( array(
18 'name' => 'temp',
19 'url' => 'http://localhost/thumbtest',
20 'backend' => $this->backend
21 ) );
23 $this->handler = new SvgHandler;
26 /**
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() {
40 return array(
41 array( 'Tux.svg', array(
42 'ObjectName' => 'Tux',
43 'ImageDescription' =>
44 'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
45 ) ),
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 );