I like better checking for the actual extension, loading if needed (and able).
authorPlatonides <platonides@users.mediawiki.org>
Wed, 20 Jul 2011 15:24:21 +0000 (15:24 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Wed, 20 Jul 2011 15:24:21 +0000 (15:24 +0000)
tests/phpunit/includes/media/ExifBitmapTest.php
tests/phpunit/includes/media/JpegTest.php

index f8b3717..3c6c46a 100644 (file)
@@ -1,9 +1,9 @@
 <?php
+
 class ExifBitmapTest extends MediaWikiTestCase {
 
        public function testIsOldBroken() {
-               global $wgShowEXIF;
-               if ( !$wgShowEXIF ) {
+               if ( wfDl( 'exif' ) ) {
                        $this->markTestIncomplete( "This test needs the exif extension." );
                }
                $handler = new ExifBitmapHandler;
@@ -11,8 +11,7 @@ class ExifBitmapTest extends MediaWikiTestCase {
                $this->assertEquals( ExifBitmapHandler::METADATA_COMPATIBLE, $res );
        }
        public function testIsBrokenFile() {
-               global $wgShowEXIF;
-               if ( !$wgShowEXIF ) {
+               if ( !wfDl( 'exif' ) ) {
                        $this->markTestIncomplete( "This test needs the exif extension." );
                }
                $handler = new ExifBitmapHandler;
@@ -20,8 +19,7 @@ class ExifBitmapTest extends MediaWikiTestCase {
                $this->assertEquals( ExifBitmapHandler::METADATA_GOOD, $res );
        }
        public function testIsInvalid() {
-               global $wgShowEXIF;
-               if ( !$wgShowEXIF ) {
+               if ( !wfDl( 'exif' ) ) {
                        $this->markTestIncomplete( "This test needs the exif extension." );
                }
                $handler = new ExifBitmapHandler;
@@ -29,8 +27,7 @@ class ExifBitmapTest extends MediaWikiTestCase {
                $this->assertEquals( ExifBitmapHandler::METADATA_BAD, $res );
        }
        public function testGoodMetadata() {
-               global $wgShowEXIF;
-               if ( !$wgShowEXIF ) {
+               if ( !wfDl( 'exif' ) ) {
                        $this->markTestIncomplete( "This test needs the exif extension." );
                }
                $handler = new ExifBitmapHandler;
@@ -39,8 +36,7 @@ class ExifBitmapTest extends MediaWikiTestCase {
                $this->assertEquals( ExifBitmapHandler::METADATA_GOOD, $res );
        }
        public function testIsOldGood() {
-               global $wgShowEXIF;
-               if ( !$wgShowEXIF ) {
+               if ( !wfDl( 'exif' ) ) {
                        $this->markTestIncomplete( "This test needs the exif extension." );
                }
                $handler = new ExifBitmapHandler;
@@ -51,8 +47,7 @@ class ExifBitmapTest extends MediaWikiTestCase {
        // Handle metadata from paged tiff handler (gotten via instant commons)
        // gracefully.
        public function testPagedTiffHandledGracefully() {
-               global $wgShowEXIF;
-               if ( !$wgShowEXIF ) {
+               if ( !wfDl( 'exif' ) ) {
                        $this->markTestIncomplete( "This test needs the exif extension." );
                }
                $handler = new ExifBitmapHandler;
index cc2e556..da02fe5 100644 (file)
@@ -1,9 +1,10 @@
 <?php
+wfDl('exif');
+
 class JpegTest extends MediaWikiTestCase {
 
        public function testInvalidFile() {
-               global $wgShowEXIF;
-               if ( !$wgShowEXIF ) {
+               if ( !wfDl( 'exif' ) ) {
                        $this->markTestIncomplete( "This test needs the exif extension." );
                }
                $jpeg = new JpegHandler;
@@ -11,8 +12,7 @@ class JpegTest extends MediaWikiTestCase {
                $this->assertEquals( ExifBitmapHandler::BROKEN_FILE, $res );
        }
        public function testTiffFile() {
-               global $wgShowEXIF;
-               if ( !$wgShowEXIF ) {
+               if ( !wfDl( 'exif' ) ) {
                        $this->markTestIncomplete( "This test needs the exif extension." );
                }
                $h = new JpegHandler;