X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fmaintenance%2FDumpTestCase.php;h=1d55ab8434f0a088825e139bffd980266794718f;hb=02534f69c0776393631b2e90cd8898be49e931d0;hp=c846c0677d0eb7617372dd8b190225818e052230;hpb=4618f70793d1178ca4c646ef397cf17b1cc70b44;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/maintenance/DumpTestCase.php b/tests/phpunit/maintenance/DumpTestCase.php index c846c0677d..1d55ab8434 100644 --- a/tests/phpunit/maintenance/DumpTestCase.php +++ b/tests/phpunit/maintenance/DumpTestCase.php @@ -25,6 +25,26 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { */ protected $xml = null; + /** @var bool|null Whether the 'gzip' utility is available */ + protected static $hasGzip = null; + + /** + * Skip the test if 'gzip' is not in $PATH. + * + * @return bool + */ + protected function checkHasGzip() { + if ( self::$hasGzip === null ) { + self::$hasGzip = ( Installer::locateExecutableInDefaultPaths( 'gzip' ) !== false ); + } + + if ( !self::$hasGzip ) { + $this->markTestSkipped( "Skip test, requires the gzip utility in PATH" ); + } + + return self::$hasGzip; + } + /** * Adds a revision to a page, while returning the resuting revision's id * @@ -49,11 +69,12 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { $text_id = $revision->getTextId(); if ( ( $revision_id > 0 ) && ( $text_id > 0 ) ) { - return array( $revision_id, $text_id ); + return [ $revision_id, $text_id ]; } } - throw new MWException( "Could not determine revision id (" . $status->getWikiText() . ")" ); + throw new MWException( "Could not determine revision id (" + . $status->getWikiText( false, false, 'en' ) . ")" ); } /**