From 02fbbd5a427346ecae0720ae096e1f6e5c42088d Mon Sep 17 00:00:00 2001 From: John Stevenson Date: Tue, 19 Dec 2017 10:07:09 +0000 Subject: [PATCH] Skip MockedZipDownloader tests if zip is missing (#6917) * Skip MockedZipDownloader tests if zip is missing --- .../Test/Downloader/ZipDownloaderTest.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/Composer/Test/Downloader/ZipDownloaderTest.php b/tests/Composer/Test/Downloader/ZipDownloaderTest.php index 3b5c46373..9c437e786 100644 --- a/tests/Composer/Test/Downloader/ZipDownloaderTest.php +++ b/tests/Composer/Test/Downloader/ZipDownloaderTest.php @@ -110,6 +110,10 @@ class ZipDownloaderTest extends TestCase */ public function testZipArchiveOnlyFailed() { + if (!class_exists('ZipArchive')) { + $this->markTestSkipped('zip extension missing'); + } + $this->setPrivateProperty('hasSystemUnzip', false); $this->setPrivateProperty('hasZipArchive', true); $downloader = new MockedZipDownloader($this->io, $this->config); @@ -132,6 +136,10 @@ class ZipDownloaderTest extends TestCase */ public function testZipArchiveExtractOnlyFailed() { + if (!class_exists('ZipArchive')) { + $this->markTestSkipped('zip extension missing'); + } + $this->setPrivateProperty('hasSystemUnzip', false); $this->setPrivateProperty('hasZipArchive', true); $downloader = new MockedZipDownloader($this->io, $this->config); @@ -153,6 +161,10 @@ class ZipDownloaderTest extends TestCase */ public function testZipArchiveOnlyGood() { + if (!class_exists('ZipArchive')) { + $this->markTestSkipped('zip extension missing'); + } + $this->setPrivateProperty('hasSystemUnzip', false); $this->setPrivateProperty('hasZipArchive', true); $downloader = new MockedZipDownloader($this->io, $this->config); @@ -175,6 +187,10 @@ class ZipDownloaderTest extends TestCase */ public function testSystemUnzipOnlyFailed() { + if (!class_exists('ZipArchive')) { + $this->markTestSkipped('zip extension missing'); + } + $this->setPrivateProperty('hasSystemUnzip', true); $this->setPrivateProperty('hasZipArchive', false); $processExecutor = $this->getMock('Composer\Util\ProcessExecutor'); @@ -188,6 +204,10 @@ class ZipDownloaderTest extends TestCase public function testSystemUnzipOnlyGood() { + if (!class_exists('ZipArchive')) { + $this->markTestSkipped('zip extension missing'); + } + $this->setPrivateProperty('hasSystemUnzip', true); $this->setPrivateProperty('hasZipArchive', false); $processExecutor = $this->getMock('Composer\Util\ProcessExecutor'); @@ -201,6 +221,10 @@ class ZipDownloaderTest extends TestCase public function testNonWindowsFallbackGood() { + if (!class_exists('ZipArchive')) { + $this->markTestSkipped('zip extension missing'); + } + $this->setPrivateProperty('isWindows', false); $this->setPrivateProperty('hasSystemUnzip', true); $this->setPrivateProperty('hasZipArchive', true); @@ -229,6 +253,10 @@ class ZipDownloaderTest extends TestCase */ public function testNonWindowsFallbackFailed() { + if (!class_exists('ZipArchive')) { + $this->markTestSkipped('zip extension missing'); + } + $this->setPrivateProperty('isWindows', false); $this->setPrivateProperty('hasSystemUnzip', true); $this->setPrivateProperty('hasZipArchive', true); @@ -253,6 +281,10 @@ class ZipDownloaderTest extends TestCase public function testWindowsFallbackGood() { + if (!class_exists('ZipArchive')) { + $this->markTestSkipped('zip extension missing'); + } + $this->setPrivateProperty('isWindows', true); $this->setPrivateProperty('hasSystemUnzip', true); $this->setPrivateProperty('hasZipArchive', true); @@ -281,6 +313,10 @@ class ZipDownloaderTest extends TestCase */ public function testWindowsFallbackFailed() { + if (!class_exists('ZipArchive')) { + $this->markTestSkipped('zip extension missing'); + } + $this->setPrivateProperty('isWindows', true); $this->setPrivateProperty('hasSystemUnzip', true); $this->setPrivateProperty('hasZipArchive', true);