I like better checking for the actual extension, loading if needed (and able).
[lhc/web/wiklou.git] / tests / phpunit / includes / media / JpegTest.php
1 <?php
2 wfDl('exif');
3
4 class JpegTest extends MediaWikiTestCase {
5
6 public function testInvalidFile() {
7 if ( !wfDl( 'exif' ) ) {
8 $this->markTestIncomplete( "This test needs the exif extension." );
9 }
10 $jpeg = new JpegHandler;
11 $res = $jpeg->getMetadata( null, dirname( __FILE__ ) . '/README' );
12 $this->assertEquals( ExifBitmapHandler::BROKEN_FILE, $res );
13 }
14 public function testTiffFile() {
15 if ( !wfDl( 'exif' ) ) {
16 $this->markTestIncomplete( "This test needs the exif extension." );
17 }
18 $h = new JpegHandler;
19 $res = $h->getMetadata( null, dirname( __FILE__ ) . '/test.jpg' );
20 $expected = 'a:7:{s:16:"ImageDescription";s:9:"Test file";s:11:"XResolution";s:4:"72/1";s:11:"YResolution";s:4:"72/1";s:14:"ResolutionUnit";i:2;s:16:"YCbCrPositioning";i:1;s:15:"JPEGFileComment";a:1:{i:0;s:17:"Created with GIMP";}s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}';
21 // Hopefully php always serializes things in the same order.
22 $this->assertEquals( $expected, $res );
23 }
24 }