Skip to content

Commit b24ee89

Browse files
Fyorlbantu
authored andcommitted
[ticket/11109] Re-add file conflict checks to compress class
PHPBB3-11109
1 parent 9142388 commit b24ee89

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

tests/compress/compress_test.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ class phpbb_compress_test extends phpbb_test_case
2525
'dir/subdir/4.txt',
2626
);
2727

28+
protected $conflicts = array(
29+
'1_1.txt',
30+
'1_2.txt',
31+
'dir/2_1.txt',
32+
);
33+
2834
protected function setUp()
2935
{
3036
// Required for compress::add_file
@@ -82,6 +88,11 @@ protected function archive_files($compress)
8288
);
8389
$compress->add_custom_file($this->path . 'dir/3.txt', 'dir/3.txt');
8490
$compress->add_data(file_get_contents($this->path . 'dir/subdir/4.txt'), 'dir/subdir/4.txt');
91+
92+
// Add multiples of the same file to check conflicts are handled
93+
$compress->add_file($this->path . '1.txt', $this->path);
94+
$compress->add_file($this->path . '1.txt', $this->path);
95+
$compress->add_file($this->path . 'dir/2.txt', $this->path);
8596
}
8697

8798
protected function valid_extraction($extra = array())
@@ -141,7 +152,7 @@ public function test_compress_tar($filename, $type)
141152
$compress->mode = 'r';
142153
$compress->open();
143154
$compress->extract('tests/compress/' . self::EXTRACT_DIR);
144-
$this->valid_extraction();
155+
$this->valid_extraction($this->conflicts);
145156
}
146157

147158
/**
@@ -157,6 +168,6 @@ public function test_compress_zip()
157168

158169
$compress = new compress_zip('r', $zip);
159170
$compress->extract('tests/compress/' . self::EXTRACT_DIR);
160-
$this->valid_extraction();
171+
$this->valid_extraction($this->conflicts);
161172
}
162173
}

0 commit comments

Comments
 (0)