Merge "jquery.spinner: Improve documentation formatting"
[lhc/web/wiklou.git] / tests / phpunit / includes / media / SVGTest.php
1 <?php
2
3 class SvgTest extends MediaWikiTestCase {
4
5 protected function setUp() {
6 parent::setUp();
7
8 $this->filePath = __DIR__ . '/../../data/media/';
9
10 $this->setMwGlobals( 'wgShowEXIF', true );
11
12 $this->backend = new FSFileBackend( array(
13 'name' => 'localtesting',
14 'lockManager' => 'nullLockManager',
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 ) );
22
23 $this->handler = new SvgHandler;
24 }
25
26 /**
27 * @param $filename String
28 * @param $expected Array The expected independent metadata
29 * @dataProvider providerGetIndependentMetaArray
30 * @covers SvgHandler::getCommonMetaArray
31 */
32 public function testGetIndependentMetaArray( $filename, $expected ) {
33 $file = $this->dataFile( $filename, 'image/svg+xml' );
34 $res = $this->handler->getCommonMetaArray( $file );
35
36 $this->assertEquals( $res, $expected );
37 }
38
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() )
46 );
47 }
48
49 private function dataFile( $name, $type ) {
50 return new UnregisteredLocalFile( false, $this->repo,
51 "mwstore://localtesting/data/$name", $type );
52 }
53 }