return;
}
// TODO: find and store type of xml snippet. metadata['metadataType'] = "rdf"
- $this->metadata[$metafield] = trim( $this->reader->readInnerXML() );
+ if( method_exists( $this->reader, 'readInnerXML()' ) ) {
+ $this->metadata[$metafield] = trim( $this->reader->readInnerXML() );
+ } else {
+ throw new MWException( "The PHP XMLReader extension does not comes with readInnerXML() method. Your libxml is probably out of date (need 2.6.20 or later)." );
+ }
$this->reader->next();
}
* @dataProvider providerSvgFiles
*/
function testGetMetadata( $infile, $expected ) {
+ $this->assertMetadata( $infile, $expected );
+ }
+
+ /**
+ * @dataProvider providerSvgFilesWithXMLMetadata
+ */
+ function testGetXMLMetadata( $infile, $expected ) {
+ $r = new XMLReader();
+ if( !method_exists( $r, 'readInnerXML()' ) ) {
+ $this->markTestSkipped( 'XMLReader::readInnerXML() does not exist (libxml >2.6.20 needed).' );
+ return;
+ }
+ $this->assertMetadata( $infile, $expected );
+ }
+
+ function assertMetadata( $infile, $expected ) {
try {
$data = SVGMetadataExtractor::getMetadata( $infile );
$this->assertEquals( $expected, $data, 'SVG metadata extraction test' );
'height' => 60
)
),
+ );
+ }
+
+ function providerSvgFilesWithXMLMetadata() {
+ $base = dirname( __FILE__ );
+ return array(
array(
"$base/US_states_by_total_state_tax_revenue.svg",
array(