From a392d14dae75e0e40583c26741ead94fde63a0fe Mon Sep 17 00:00:00 2001 From: Ryan Kaldari Date: Fri, 17 Jun 2011 21:15:24 +0000 Subject: [PATCH] skip gzip tests if gzip is turned off --- tests/phpunit/includes/RevisionTest.php | 52 +++++++++++++++---------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/tests/phpunit/includes/RevisionTest.php b/tests/phpunit/includes/RevisionTest.php index e706b9fea1..d7654db9f2 100644 --- a/tests/phpunit/includes/RevisionTest.php +++ b/tests/phpunit/includes/RevisionTest.php @@ -32,12 +32,16 @@ class RevisionTest extends MediaWikiTestCase { } function testGetRevisionTextGzip() { - $row = new stdClass; - $row->old_flags = 'gzip'; - $row->old_text = gzdeflate( 'This is a bunch of revision text.' ); - $this->assertEquals( - 'This is a bunch of revision text.', - Revision::getRevisionText( $row ) ); + if ( !function_exists( 'gzdeflate' ) ) { + $this->markTestSkipped( 'Gzip compression is not enabled (requires zlib).' ); + } else { + $row = new stdClass; + $row->old_flags = 'gzip'; + $row->old_text = gzdeflate( 'This is a bunch of revision text.' ); + $this->assertEquals( + 'This is a bunch of revision text.', + Revision::getRevisionText( $row ) ); + } } function testGetRevisionTextUtf8Native() { @@ -61,23 +65,31 @@ class RevisionTest extends MediaWikiTestCase { } function testGetRevisionTextUtf8NativeGzip() { - $row = new stdClass; - $row->old_flags = 'gzip,utf-8'; - $row->old_text = gzdeflate( "Wiki est l'\xc3\xa9cole superieur !" ); - $GLOBALS['wgLegacyEncoding'] = 'iso-8859-1'; - $this->assertEquals( - "Wiki est l'\xc3\xa9cole superieur !", - Revision::getRevisionText( $row ) ); + if ( !function_exists( 'gzdeflate' ) ) { + $this->markTestSkipped( 'Gzip compression is not enabled (requires zlib).' ); + } else { + $row = new stdClass; + $row->old_flags = 'gzip,utf-8'; + $row->old_text = gzdeflate( "Wiki est l'\xc3\xa9cole superieur !" ); + $GLOBALS['wgLegacyEncoding'] = 'iso-8859-1'; + $this->assertEquals( + "Wiki est l'\xc3\xa9cole superieur !", + Revision::getRevisionText( $row ) ); + } } function testGetRevisionTextUtf8LegacyGzip() { - $row = new stdClass; - $row->old_flags = 'gzip'; - $row->old_text = gzdeflate( "Wiki est l'\xe9cole superieur !" ); - $GLOBALS['wgLegacyEncoding'] = 'iso-8859-1'; - $this->assertEquals( - "Wiki est l'\xc3\xa9cole superieur !", - Revision::getRevisionText( $row ) ); + if ( !function_exists( 'gzdeflate' ) ) { + $this->markTestSkipped( 'Gzip compression is not enabled (requires zlib).' ); + } else { + $row = new stdClass; + $row->old_flags = 'gzip'; + $row->old_text = gzdeflate( "Wiki est l'\xe9cole superieur !" ); + $GLOBALS['wgLegacyEncoding'] = 'iso-8859-1'; + $this->assertEquals( + "Wiki est l'\xc3\xa9cole superieur !", + Revision::getRevisionText( $row ) ); + } } function testCompressRevisionTextUtf8() { -- 2.20.1