r92635 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92634‎ | r92635 | r92636 >
Date:15:24, 20 July 2011
Author:platonides
Status:resolved
Tags:
Comment:
I like better checking for the actual extension, loading if needed (and able).
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/media/ExifBitmapTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/media/JpegTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/media/JpegTest.php
@@ -1,9 +1,10 @@
22 <?php
 3+wfDl('exif');
 4+
35 class JpegTest extends MediaWikiTestCase {
46
57 public function testInvalidFile() {
6 - global $wgShowEXIF;
7 - if ( !$wgShowEXIF ) {
 8+ if ( !wfDl( 'exif' ) ) {
89 $this->markTestIncomplete( "This test needs the exif extension." );
910 }
1011 $jpeg = new JpegHandler;
@@ -11,8 +12,7 @@
1213 $this->assertEquals( ExifBitmapHandler::BROKEN_FILE, $res );
1314 }
1415 public function testTiffFile() {
15 - global $wgShowEXIF;
16 - if ( !$wgShowEXIF ) {
 16+ if ( !wfDl( 'exif' ) ) {
1717 $this->markTestIncomplete( "This test needs the exif extension." );
1818 }
1919 $h = new JpegHandler;
Index: trunk/phase3/tests/phpunit/includes/media/ExifBitmapTest.php
@@ -1,9 +1,9 @@
22 <?php
 3+
34 class ExifBitmapTest extends MediaWikiTestCase {
45
56 public function testIsOldBroken() {
6 - global $wgShowEXIF;
7 - if ( !$wgShowEXIF ) {
 7+ if ( wfDl( 'exif' ) ) {
88 $this->markTestIncomplete( "This test needs the exif extension." );
99 }
1010 $handler = new ExifBitmapHandler;
@@ -11,8 +11,7 @@
1212 $this->assertEquals( ExifBitmapHandler::METADATA_COMPATIBLE, $res );
1313 }
1414 public function testIsBrokenFile() {
15 - global $wgShowEXIF;
16 - if ( !$wgShowEXIF ) {
 15+ if ( !wfDl( 'exif' ) ) {
1716 $this->markTestIncomplete( "This test needs the exif extension." );
1817 }
1918 $handler = new ExifBitmapHandler;
@@ -20,8 +19,7 @@
2120 $this->assertEquals( ExifBitmapHandler::METADATA_GOOD, $res );
2221 }
2322 public function testIsInvalid() {
24 - global $wgShowEXIF;
25 - if ( !$wgShowEXIF ) {
 23+ if ( !wfDl( 'exif' ) ) {
2624 $this->markTestIncomplete( "This test needs the exif extension." );
2725 }
2826 $handler = new ExifBitmapHandler;
@@ -29,8 +27,7 @@
3028 $this->assertEquals( ExifBitmapHandler::METADATA_BAD, $res );
3129 }
3230 public function testGoodMetadata() {
33 - global $wgShowEXIF;
34 - if ( !$wgShowEXIF ) {
 31+ if ( !wfDl( 'exif' ) ) {
3532 $this->markTestIncomplete( "This test needs the exif extension." );
3633 }
3734 $handler = new ExifBitmapHandler;
@@ -39,8 +36,7 @@
4037 $this->assertEquals( ExifBitmapHandler::METADATA_GOOD, $res );
4138 }
4239 public function testIsOldGood() {
43 - global $wgShowEXIF;
44 - if ( !$wgShowEXIF ) {
 40+ if ( !wfDl( 'exif' ) ) {
4541 $this->markTestIncomplete( "This test needs the exif extension." );
4642 }
4743 $handler = new ExifBitmapHandler;
@@ -51,8 +47,7 @@
5248 // Handle metadata from paged tiff handler (gotten via instant commons)
5349 // gracefully.
5450 public function testPagedTiffHandledGracefully() {
55 - global $wgShowEXIF;
56 - if ( !$wgShowEXIF ) {
 51+ if ( !wfDl( 'exif' ) ) {
5752 $this->markTestIncomplete( "This test needs the exif extension." );
5853 }
5954 $handler = new ExifBitmapHandler;

Follow-up revisions

RevisionCommit summaryAuthorDate
r92637Follow up r92635.platonides15:30, 20 July 2011
r92639Follow up r92635platonides15:35, 20 July 2011
r94825follow-up r91885 - address CR comments...bawolff21:53, 17 August 2011
r97398Follow-up r92635 Make sure the Exif related tests handle not having the Exif ...bawolff01:53, 18 September 2011

Status & tagging log