Replace a bunch of extension_loaded() checks with checkPHPExtension()
authorPlatonides <platonides@gmail.com>
Sat, 23 Nov 2013 19:20:23 +0000 (20:20 +0100)
committerReedy <reedy@wikimedia.org>
Thu, 23 Jan 2014 23:09:53 +0000 (23:09 +0000)
Change-Id: I7bd9bc3a753975f45e63532d4f07aeff853b9970

tests/phpunit/includes/CollationTest.php
tests/phpunit/includes/DiffHistoryBlobTest.php
tests/phpunit/includes/media/BitmapMetadataHandlerTest.php
tests/phpunit/includes/media/ExifBitmapTest.php
tests/phpunit/includes/media/ExifRotationTest.php
tests/phpunit/includes/media/ExifTest.php
tests/phpunit/includes/media/FormatMetadataTest.php
tests/phpunit/includes/media/JpegTest.php
tests/phpunit/includes/media/TiffTest.php
tests/phpunit/includes/media/XMPTest.php

index c6a7169..213e610 100644 (file)
@@ -10,9 +10,7 @@
 class CollationTest extends MediaWikiLangTestCase {
        protected function setUp() {
                parent::setUp();
-               if ( !extension_loaded( 'intl' ) ) {
-                       $this->markTestSkipped( 'These tests require intl extension' );
-               }
+               $this->checkPHPExtension( 'intl' );
        }
 
        /**
index 0b04c6e..e28a92c 100644 (file)
@@ -5,19 +5,12 @@ class DiffHistoryBlobTest extends MediaWikiTestCase {
        protected function setUp() {
                parent::setUp();
 
-               if ( !extension_loaded( 'xdiff' ) ) {
-                       $this->markTestSkipped( 'The xdiff extension is not available' );
+               $this->checkPHPExtension( 'hash' );
+               $this->checkPHPExtension( 'xdiff' );
 
-                       return;
-               }
                if ( !function_exists( 'xdiff_string_rabdiff' ) ) {
                        $this->markTestSkipped( 'The version of xdiff extension is lower than 1.5.0' );
 
-                       return;
-               }
-               if ( !extension_loaded( 'hash' ) ) {
-                       $this->markTestSkipped( 'The hash extension is not available' );
-
                        return;
                }
        }
index a0e63a8..8402522 100644 (file)
@@ -19,12 +19,8 @@ class BitmapMetadataHandlerTest extends MediaWikiTestCase {
         * @covers BitmapMetadataHandler::Jpeg
         */
        public function testMultilingualCascade() {
-               if ( !extension_loaded( 'exif' ) ) {
-                       $this->markTestSkipped( "This test needs the exif extension." );
-               }
-               if ( !extension_loaded( 'xml' ) ) {
-                       $this->markTestSkipped( "This test needs the xml extension." );
-               }
+               $this->checkPHPExtension( 'exif' );
+               $this->checkPHPExtension( 'xml' );
 
                $this->setMwGlobals( 'wgShowEXIF', true );
 
index a2e0eb6..fb3e40e 100644 (file)
@@ -9,9 +9,7 @@ class ExifBitmapTest extends MediaWikiTestCase {
 
        protected function setUp() {
                parent::setUp();
-               if ( !extension_loaded( 'exif' ) ) {
-                       $this->markTestSkipped( "This test needs the exif extension." );
-               }
+               $this->checkPHPExtension( 'exif' );
 
                $this->setMwGlobals( 'wgShowEXIF', true );
 
index 118dc85..3cfbf1a 100644 (file)
@@ -10,9 +10,7 @@ class ExifRotationTest extends MediaWikiTestCase {
 
        protected function setUp() {
                parent::setUp();
-               if ( !extension_loaded( 'exif' ) ) {
-                       $this->markTestSkipped( "This test needs the exif extension." );
-               }
+               $this->checkPHPExtension( 'exif' );
 
                $this->handler = new BitmapHandler();
                $filePath = __DIR__ . '/../../data/media';
index 667c078..735663c 100644 (file)
@@ -10,9 +10,7 @@ class ExifTest extends MediaWikiTestCase {
 
        protected function setUp() {
                parent::setUp();
-               if ( !extension_loaded( 'exif' ) ) {
-                       $this->markTestSkipped( "This test needs the exif extension." );
-               }
+               $this->checkPHPExtension( 'exif' );
 
                $this->mediaPath = __DIR__ . '/../../data/media/';
 
index 44d8f00..605dfa8 100644 (file)
@@ -10,9 +10,7 @@ class FormatMetadataTest extends MediaWikiTestCase {
        protected function setUp() {
                parent::setUp();
 
-               if ( !extension_loaded( 'exif' ) ) {
-                       $this->markTestSkipped( "This test needs the exif extension." );
-               }
+               $this->checkPHPExtension( 'exif' );
                $filePath = __DIR__ . '/../../data/media';
                $this->backend = new FSFileBackend( array(
                        'name' => 'localtesting',
index a5bf1dc..1b28de1 100644 (file)
@@ -8,9 +8,7 @@ class JpegTest extends MediaWikiTestCase {
 
        protected function setUp() {
                parent::setUp();
-               if ( !extension_loaded( 'exif' ) ) {
-                       $this->markTestSkipped( "This test needs the exif extension." );
-               }
+               $this->checkPHPExtension( 'exif' );
 
                $this->filePath = __DIR__ . '/../../data/media/';
 
index 8d74b98..ca97698 100644 (file)
@@ -8,9 +8,7 @@ class TiffTest extends MediaWikiTestCase {
 
        protected function setUp() {
                parent::setUp();
-               if ( !extension_loaded( 'exif' ) ) {
-                       $this->markTestSkipped( "This test needs the exif extension." );
-               }
+               $this->checkPHPExtension( 'exif' );
 
                $this->setMwGlobals( 'wgShowEXIF', true );
 
index 9ec5796..61ba189 100644 (file)
@@ -7,9 +7,7 @@ class XMPTest extends MediaWikiTestCase {
 
        protected function setUp() {
                parent::setUp();
-               if ( !extension_loaded( 'xml' ) ) {
-                       $this->markTestSkipped( 'Requires libxml to do XMP parsing' );
-               }
+               $this->checkPHPExtension( 'exif' ); # Requires libxml to do XMP parsing
        }
 
        /**