aboutsummaryrefslogtreecommitdiffstats
path: root/tests/compress
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-12-20 13:20:05 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-12-20 13:20:05 -0500
commit00d8f944da084a660ef72f21438b22297eb1c857 (patch)
tree386a5958a1723be8cf04b4fa576385ce02b91263 /tests/compress
parentdabe88bb3a71f54c35002c85cc2c7ada23fae318 (diff)
downloadforums-00d8f944da084a660ef72f21438b22297eb1c857.tar
forums-00d8f944da084a660ef72f21438b22297eb1c857.tar.gz
forums-00d8f944da084a660ef72f21438b22297eb1c857.tar.bz2
forums-00d8f944da084a660ef72f21438b22297eb1c857.tar.xz
forums-00d8f944da084a660ef72f21438b22297eb1c857.zip
[ticket/11285] Use more granularity in dependency checks in compress test
Some of the tests can be run without zlib or bz2 extensions present. PHPBB3-11285
Diffstat (limited to 'tests/compress')
-rw-r--r--tests/compress/compress_test.php25
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/compress/compress_test.php b/tests/compress/compress_test.php
index 65094671e3..ce193cf3ba 100644
--- a/tests/compress/compress_test.php
+++ b/tests/compress/compress_test.php
@@ -32,10 +32,16 @@ class phpbb_compress_test extends phpbb_test_case
$phpbb_root_path = '';
$this->path = dirname(__FILE__) . '/fixtures/';
+ }
- if (!@extension_loaded('zlib') || !@extension_loaded('bz2'))
+ protected function check_extensions($extensions)
+ {
+ foreach ($extensions as $extension)
{
- $this->markTestSkipped('PHP needs to be compiled with --with-zlib and --with-bz2 in order to run these tests');
+ if (!@extension_loaded($extension))
+ {
+ $this->markTestSkipped("$extension extension is not loaded");
+ }
}
}
@@ -103,17 +109,18 @@ class phpbb_compress_test extends phpbb_test_case
public function tar_archive_list()
{
return array(
- array('archive.tar', '.tar'),
- array('archive.tar.gz', '.tar.gz'),
- array('archive.tar.bz2', '.tar.bz2'),
+ array('archive.tar', '.tar', array()),
+ array('archive.tar.gz', '.tar.gz', array('zlib')),
+ array('archive.tar.bz2', '.tar.bz2', array('bz2')),
);
}
/**
* @dataProvider tar_archive_list
*/
- public function test_extract_tar($filename, $type)
+ public function test_extract_tar($filename, $type, $extensions)
{
+ $this->check_extensions($extensions);
$compress = new compress_tar('r', $this->path . $filename);
$compress->extract('tests/compress/' . self::EXTRACT_DIR);
$this->valid_extraction();
@@ -130,8 +137,10 @@ class phpbb_compress_test extends phpbb_test_case
* @depends test_extract_tar
* @dataProvider tar_archive_list
*/
- public function test_compress_tar($filename, $type)
+ public function test_compress_tar($filename, $type, $extensions)
{
+ $this->check_extensions($extensions);
+
$tar = dirname(__FILE__) . self::ARCHIVE_DIR . $filename;
$compress = new compress_tar('w', $tar);
$this->archive_files($compress);
@@ -149,6 +158,8 @@ class phpbb_compress_test extends phpbb_test_case
*/
public function test_compress_zip()
{
+ $this->check_extensions(array('zlib'));
+
$zip = dirname(__FILE__) . self::ARCHIVE_DIR . 'archive.zip';
$compress = new compress_zip('w', $zip);
$this->archive_files($compress);