From 86a536451bb36b68e4be73d8a5666d74243e3a30 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Thu, 5 Dec 2019 21:23:40 +0100 Subject: [PATCH] Improve test suite because php-bz2 can be not installed Signed-off-by: William Desportes --- test/classes/FileListingTest.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/classes/FileListingTest.php b/test/classes/FileListingTest.php index 278147dea6..168ac43c77 100644 --- a/test/classes/FileListingTest.php +++ b/test/classes/FileListingTest.php @@ -47,16 +47,39 @@ class FileListingTest extends TestCase /** * @return void */ - public function testSupportedDecompressions(): void + public function testSupportedDecompressionsEmptyList(): void { $GLOBALS['cfg']['ZipDump'] = false; $GLOBALS['cfg']['GZipDump'] = false; $GLOBALS['cfg']['BZipDump'] = false; $this->assertEmpty($this->fileListing->supportedDecompressions()); + } + /** + * @return void + * @requires extension bz2 1 + */ + public function testSupportedDecompressionsFull(): void + { $GLOBALS['cfg']['ZipDump'] = true; $GLOBALS['cfg']['GZipDump'] = true; $GLOBALS['cfg']['BZipDump'] = true; $this->assertEquals('gz|bz2|zip', $this->fileListing->supportedDecompressions()); } + + /** + * @return void + */ + public function testSupportedDecompressionsPartial(): void + { + $GLOBALS['cfg']['ZipDump'] = true; + $GLOBALS['cfg']['GZipDump'] = true; + $GLOBALS['cfg']['BZipDump'] = true; + $extensionString = 'gz'; + if (extension_loaded('bz2')) { + $extensionString .= '|bz2'; + } + $extensionString .= '|zip'; + $this->assertEquals($extensionString, $this->fileListing->supportedDecompressions()); + } }