From 91e194556c52d2f354344f930419eef2dd6267f0 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 4 Sep 2013 05:51:59 +0200 Subject: Update to MediaWiki 1.21.2 --- tests/phpunit/includes/media/JpegTest.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/phpunit/includes/media/JpegTest.php (limited to 'tests/phpunit/includes/media/JpegTest.php') diff --git a/tests/phpunit/includes/media/JpegTest.php b/tests/phpunit/includes/media/JpegTest.php new file mode 100644 index 00000000..05d3661e --- /dev/null +++ b/tests/phpunit/includes/media/JpegTest.php @@ -0,0 +1,29 @@ +filePath = __DIR__ . '/../../data/media/'; + if ( !wfDl( 'exif' ) ) { + $this->markTestSkipped( "This test needs the exif extension." ); + } + + $this->setMwGlobals( 'wgShowEXIF', true ); + } + + public function testInvalidFile() { + $jpeg = new JpegHandler; + $res = $jpeg->getMetadata( null, $this->filePath . 'README' ); + $this->assertEquals( ExifBitmapHandler::BROKEN_FILE, $res ); + } + + public function testJpegMetadataExtraction() { + $h = new JpegHandler; + $res = $h->getMetadata( null, $this->filePath . 'test.jpg' ); + $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;}'; + + // Unserialize in case serialization format ever changes. + $this->assertEquals( unserialize( $expected ), unserialize( $res ) ); + } +} -- cgit v1.2.3-54-g00ecf