summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/media/SVGTest.php
blob: 8f7a0d695ace63aef4926ed1d532373344dd159f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

/**
 * @group Media
 */
class SvgTest extends MediaWikiMediaTestCase {

	protected function setUp() {
		parent::setUp();

		$this->filePath = __DIR__ . '/../../data/media/';

		$this->setMwGlobals( 'wgShowEXIF', true );

		$this->handler = new SvgHandler;
	}

	/**
	 * @param string $filename
	 * @param array $expected The expected independent metadata
	 * @dataProvider providerGetIndependentMetaArray
	 * @covers SvgHandler::getCommonMetaArray
	 */
	public function testGetIndependentMetaArray( $filename, $expected ) {
		$file = $this->dataFile( $filename, 'image/svg+xml' );
		$res = $this->handler->getCommonMetaArray( $file );

		$this->assertEquals( $res, $expected );
	}

	public static function providerGetIndependentMetaArray() {
		return array(
			array( 'Tux.svg', array(
				'ObjectName' => 'Tux',
				'ImageDescription' =>
					'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
			) ),
			array( 'Wikimedia-logo.svg', array() )
		);
	}
}