wiki.techinc.nl/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php
Brian Wolff cf32ccd072 Per CR on r86169, start adding unit tests for metadata extraction.
This is just some initial tests that really only cover png's. I plan
to add more soon.

Also well I'm here, fix the svn prop on broken_exif_date.jpg from r90421.
2011-06-23 23:25:49 +00:00

27 lines
816 B
PHP

<?php
class BitmapMetadataHandlerTest extends MediaWikiTestCase {
/**
* Test if having conflicting metadata values from different
* types of metadata, that the right one takes precedence.
*
* Basically the file has IPTC and XMP metadata, the
* IPTC should override the XMP, except for the multilingual
* translation (to en) where XMP should win.
*/
public function testMultilingualCascade() {
$meta = BitmapMetadataHandler::Jpeg( dirname( __FILE__ ) .
'/Xmp-exif-multilingual_test.jpg' );
$expected = array(
'x-default' => 'right(iptc)',
'en' => 'right translation',
'_type' => 'lang'
);
$this->assertArrayHasKey( 'ImageDescription', $meta,
'Did not extract any ImageDescription info?!' );
$this->assertEquals( $expected, $meta['ImageDescription'] );
}
}