Skip to content

Commit 991ea9c

Browse files
committed
Make zip oo_addpattern test more robust
Use a separate directory for the tests, so that no other tests can concurrently create files in the same directory.
1 parent a92db42 commit 991ea9c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ext/zip/tests/oo_addpattern.phpt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ if(!extension_loaded('zip')) die('skip');
1010
?>
1111
--FILE--
1212
<?php
13-
$dirname = dirname(__FILE__) . '/';
14-
include $dirname . 'utils.inc';
15-
$file = $dirname . '__tmp_oo_addpattern.zip';
13+
include __DIR__ . '/utils.inc';
1614

17-
copy($dirname . 'test.zip', $file);
15+
$dirname = __DIR__ . '/oo_addpattern_dir/';
16+
$file = $dirname . 'tmp.zip';
17+
18+
@mkdir($dirname);
19+
copy(__DIR__ . '/test.zip', $file);
1820
touch($dirname . 'foo.txt');
1921
touch($dirname . 'bar.txt');
2022

@@ -36,10 +38,11 @@ if ($zip->status == ZIPARCHIVE::ER_OK) {
3638
?>
3739
--CLEAN--
3840
<?php
39-
$dirname = dirname(__FILE__) . '/';
40-
unlink($dirname . '__tmp_oo_addpattern.zip');
41+
$dirname = dirname(__FILE__) . '/oo_addpattern_dir/';
42+
unlink($dirname . 'tmp.zip');
4143
unlink($dirname . 'foo.txt');
4244
unlink($dirname . 'bar.txt');
45+
rmdir($dirname);
4346
?>
4447
--EXPECT--
4548
0 bar

0 commit comments

Comments
 (0)