Improve test suite because php-bz2 can be not installed

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-12-05 21:23:40 +01:00
parent 59f5cdea43
commit 86a536451b
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -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());
}
}