Merge "Add DROP INDEX support to DatabaseSqlite::replaceVars method"
[lhc/web/wiklou.git] / tests / phpunit / includes / media / SVGTest.php
1 <?php
2 class SVGTest extends MediaWikiTestCase {
3
4 protected function setUp() {
5 parent::setUp();
6
7 $this->filePath = __DIR__ . '/../../data/media/';
8
9 $this->setMwGlobals( 'wgShowEXIF', true );
10
11 $this->backend = new FSFileBackend( array(
12 'name' => 'localtesting',
13 'lockManager' => 'nullLockManager',
14 'containerPaths' => array( 'data' => $this->filePath )
15 ) );
16 $this->repo = new FSRepo( array(
17 'name' => 'temp',
18 'url' => 'http://localhost/thumbtest',
19 'backend' => $this->backend
20 ) );
21
22 $this->handler = new SVGHandler;
23 }
24
25 /**
26 * @param $filename String
27 * @param $expected Array The expected independent metadata
28 * @dataProvider providerGetIndependentMetaArray
29 * @covers SvgHandler::getCommonMetaArray
30 */
31 public function testGetIndependentMetaArray( $filename, $expected ) {
32 $file = $this->dataFile( $filename, 'image/svg+xml' );
33 $res = $this->handler->getCommonMetaArray( $file );
34
35 $this->assertEquals( $res, $expected );
36 }
37
38 public function providerGetIndependentMetaArray() {
39 return array(
40 array( 'Tux.svg', array(
41 'ObjectName' => 'Tux',
42 'ImageDescription' => 'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
43 ) ),
44 array( 'Wikimedia-logo.svg', array() )
45 );
46 }
47
48 private function dataFile( $name, $type ) {
49 return new UnregisteredLocalFile( false, $this->repo,
50 "mwstore://localtesting/data/$name", $type );
51 }
52 }