X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fmaintenance%2FDumpTestCase.php;h=99bd427737903d14459a734d983628f0dcd7b1fe;hb=85ac1b5d7c7ca50a93f2d16639cdde2f46bc133e;hp=7336618ebf51a60c87ef1fd8ee32354ac1b1cbb7;hpb=c340c41b37b5079ba90489f6b212bb8e4642031a;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/maintenance/DumpTestCase.php b/tests/phpunit/maintenance/DumpTestCase.php index 7336618ebf..99bd427737 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 * @@ -53,7 +73,8 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { } } - throw new MWException( "Could not determine revision id (" . $status->getWikiText() . ")" ); + throw new MWException( "Could not determine revision id (" + . $status->getWikiText( false, false, 'en' ) . ")" ); } /** @@ -277,7 +298,6 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { * @param string $name Title of the current page */ protected function assertPageStart( $id, $ns, $name ) { - $this->assertNodeStart( "page" ); $this->skipWhitespace(); @@ -372,7 +392,6 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { if ( ( $this->xml->nodeType == XMLReader::END_ELEMENT ) && ( $this->xml->name == "text" ) ) { - $this->xml->read(); } $this->skipWhitespace();