Index: trunk/phase3/tests/phpunit/includes/media/JpegTest.php |
— | — | @@ -1,6 +1,4 @@ |
2 | 2 | <?php |
3 | | -wfDl('exif'); |
4 | | - |
5 | 3 | class JpegTest extends MediaWikiTestCase { |
6 | 4 | |
7 | 5 | public function testInvalidFile() { |
— | — | @@ -18,7 +16,8 @@ |
19 | 17 | $h = new JpegHandler; |
20 | 18 | $res = $h->getMetadata( null, dirname( __FILE__ ) . '/test.jpg' ); |
21 | 19 | $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;}'; |
22 | | - // Hopefully php always serializes things in the same order. |
23 | | - $this->assertEquals( $expected, $res ); |
| 20 | + |
| 21 | + // Unserialize in case serialization format ever changes. |
| 22 | + $this->assertEquals( unserialize( $expected ), unserialize( $res ) ); |
24 | 23 | } |
25 | 24 | } |
Index: trunk/phase3/tests/phpunit/includes/media/TiffTest.php |
— | — | @@ -21,14 +21,15 @@ |
22 | 22 | $this->assertEquals( ExifBitmapHandler::BROKEN_FILE, $res ); |
23 | 23 | } |
24 | 24 | |
25 | | - public function testTiffFile() { |
| 25 | + public function testTiffMetadataExtraction() { |
26 | 26 | if ( !wfDl( 'exif' ) ) { |
27 | 27 | $this->markTestIncomplete( "This test needs the exif extension." ); |
28 | 28 | } |
29 | 29 | $tiff = new TiffHandler; |
30 | 30 | $res = $tiff->getMetadata( null, dirname( __FILE__ ) . '/test.tiff' ); |
31 | 31 | $expected = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}'; |
32 | | - // Hopefully php always serializes things in the same order. |
33 | | - $this->assertEquals( $expected, $res ); |
| 32 | + // Re-unserialize in case there are subtle differences between how versions |
| 33 | + // of php serialize stuff. |
| 34 | + $this->assertEquals( unserialize( $expected ), unserialize( $res ) ); |
34 | 35 | } |
35 | 36 | } |