mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/11109] Re-add file conflict checks to compress class
PHPBB3-11109
This commit is contained in:
parent
91423880da
commit
b24ee89cfc
1 changed files with 13 additions and 2 deletions
|
@ -25,6 +25,12 @@ class phpbb_compress_test extends phpbb_test_case
|
||||||
'dir/subdir/4.txt',
|
'dir/subdir/4.txt',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
protected $conflicts = array(
|
||||||
|
'1_1.txt',
|
||||||
|
'1_2.txt',
|
||||||
|
'dir/2_1.txt',
|
||||||
|
);
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
// Required for compress::add_file
|
// Required for compress::add_file
|
||||||
|
@ -82,6 +88,11 @@ class phpbb_compress_test extends phpbb_test_case
|
||||||
);
|
);
|
||||||
$compress->add_custom_file($this->path . 'dir/3.txt', 'dir/3.txt');
|
$compress->add_custom_file($this->path . 'dir/3.txt', 'dir/3.txt');
|
||||||
$compress->add_data(file_get_contents($this->path . 'dir/subdir/4.txt'), 'dir/subdir/4.txt');
|
$compress->add_data(file_get_contents($this->path . 'dir/subdir/4.txt'), 'dir/subdir/4.txt');
|
||||||
|
|
||||||
|
// Add multiples of the same file to check conflicts are handled
|
||||||
|
$compress->add_file($this->path . '1.txt', $this->path);
|
||||||
|
$compress->add_file($this->path . '1.txt', $this->path);
|
||||||
|
$compress->add_file($this->path . 'dir/2.txt', $this->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function valid_extraction($extra = array())
|
protected function valid_extraction($extra = array())
|
||||||
|
@ -141,7 +152,7 @@ class phpbb_compress_test extends phpbb_test_case
|
||||||
$compress->mode = 'r';
|
$compress->mode = 'r';
|
||||||
$compress->open();
|
$compress->open();
|
||||||
$compress->extract('tests/compress/' . self::EXTRACT_DIR);
|
$compress->extract('tests/compress/' . self::EXTRACT_DIR);
|
||||||
$this->valid_extraction();
|
$this->valid_extraction($this->conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,6 +168,6 @@ class phpbb_compress_test extends phpbb_test_case
|
||||||
|
|
||||||
$compress = new compress_zip('r', $zip);
|
$compress = new compress_zip('r', $zip);
|
||||||
$compress->extract('tests/compress/' . self::EXTRACT_DIR);
|
$compress->extract('tests/compress/' . self::EXTRACT_DIR);
|
||||||
$this->valid_extraction();
|
$this->valid_extraction($this->conflicts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue