Move the image files used in the media tests from includes/media to data/media as...
[lhc/web/wiklou.git] / tests / phpunit / includes / media / BitmapMetadataHandlerTest.php
1 <?php
2 class BitmapMetadataHandlerTest extends MediaWikiTestCase {
3
4 public function setUp() {
5 $this->filePath = dirname( __FILE__ ) . '/../../data/media/';
6 }
7
8 /**
9 * Test if having conflicting metadata values from different
10 * types of metadata, that the right one takes precedence.
11 *
12 * Basically the file has IPTC and XMP metadata, the
13 * IPTC should override the XMP, except for the multilingual
14 * translation (to en) where XMP should win.
15 */
16 public function testMultilingualCascade() {
17 if ( !wfDl( 'exif' ) ) {
18 $this->markTestIncomplete( "This test needs the exif extension." );
19 }
20
21 $meta = BitmapMetadataHandler::Jpeg( $this->filePath .
22 '/Xmp-exif-multilingual_test.jpg' );
23
24 $expected = array(
25 'x-default' => 'right(iptc)',
26 'en' => 'right translation',
27 '_type' => 'lang'
28 );
29
30 $this->assertArrayHasKey( 'ImageDescription', $meta,
31 'Did not extract any ImageDescription info?!' );
32
33 $this->assertEquals( $expected, $meta['ImageDescription'] );
34 }
35 }