3 class SVGMetadataExtractorTest
extends MediaWikiTestCase
{
6 AutoLoader
::loadClass( 'SVGMetadataExtractorTest' );
10 * @dataProvider providerSvgFiles
12 function testGetMetadata( $infile, $expected ) {
13 $this->assertMetadata( $infile, $expected );
17 * @dataProvider providerSvgFilesWithXMLMetadata
19 function testGetXMLMetadata( $infile, $expected ) {
21 if( !method_exists( $r, 'readInnerXML()' ) ) {
22 $this->markTestSkipped( 'XMLReader::readInnerXML() does not exist (libxml >2.6.20 needed).' );
25 $this->assertMetadata( $infile, $expected );
28 function assertMetadata( $infile, $expected ) {
30 $data = SVGMetadataExtractor
::getMetadata( $infile );
31 $this->assertEquals( $expected, $data, 'SVG metadata extraction test' );
32 } catch ( MWException
$e ) {
33 if ( $expected === false ) {
34 $this->assertTrue( true, 'SVG metadata extracted test (expected failure)' );
41 function providerSvgFiles() {
42 $base = dirname( __FILE__
);
45 "$base/Wikimedia-logo.svg",
59 "$base/Gtk-media-play-ltr.svg",
68 function providerSvgFilesWithXMLMetadata() {
69 $base = dirname( __FILE__
);
72 "$base/US_states_by_total_state_tax_revenue.svg",
76 '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
77 <ns4:Work xmlns:ns4="http://creativecommons.org/ns#" rdf:about="">
78 <ns5:format xmlns:ns5="http://purl.org/dc/elements/1.1/">image/svg+xml</ns5:format>
79 <ns5:type xmlns:ns5="http://purl.org/dc/elements/1.1/" rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>