Merge "Blacklist Google Glass web browser from JS"
[mediawiki.git] / tests / phpunit / includes / media / SVGTest.php
blobdafcae7de8876f339bb0403c90fae564abf94fd0
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 $filename String
28 * @param $expected Array 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' => 'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
44 ) ),
45 array( 'Wikimedia-logo.svg', array() )
49 private function dataFile( $name, $type ) {
50 return new UnregisteredLocalFile( false, $this->repo,
51 "mwstore://localtesting/data/$name", $type );