Some of our tests explicitly depends on the 'gzip' command line utility,
for example the Dumps test suite. This patch adds up a simple helper
MediaWikiTestCase::checkHasGzip() which skips tests whenever gzip is
missing.
Change-Id: I5ded9a53d08dcf5f35e666f91e3f64e6e111af32
}
}
+ /**
+ * Check whether we have the 'gzip' commandline utility, will skip
+ * the test whenever "gzip -V" fails.
+ *
+ * Result is cached at the process level.
+ *
+ * @return bool
+ *
+ * @since 1.21
+ */
+ protected function checkHasGzip() {
+ static $haveGzip;
+
+ if( $haveGzip === null ) {
+ $retval = null;
+ wfShellExec( 'gzip -V', $retval );
+ $haveGzip = ($retval === 0);
+ }
+
+ if( !$haveGzip ) {
+ $this->markTestSkipped( "Skip test, requires the gzip utility in PATH" );
+ }
+
+ return $haveGzip;
+ }
+
/**
* Check if $extName is a loaded PHP extension, will skip the
* test whenever it is not loaded.