Skip to content

Commit 6964ba0

Browse files
committed
Make zip oo_addglob test more robust
Use a separate directory for the test, so files created in the main test directory cannot influence it.
1 parent caee56d commit 6964ba0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ext/zip/tests/oo_addglob.phpt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ if(!defined("GLOB_BRACE")) die ('skip');
1111
?>
1212
--FILE--
1313
<?php
14-
$dirname = dirname(__FILE__) . '/';
15-
include $dirname . 'utils.inc';
16-
$file = $dirname . '__tmp_oo_addglob.zip';
14+
include __DIR__ . '/utils.inc';
15+
$dirname = __DIR__ . '/oo_addglob_dir/';
16+
$file = $dirname . 'tmp.zip';
1717

18-
copy($dirname . 'test.zip', $file);
18+
@mkdir($dirname);
19+
copy(__DIR__ . '/test.zip', $file);
1920
touch($dirname . 'foo.txt');
2021
touch($dirname . 'bar.baz');
2122

@@ -36,10 +37,11 @@ if ($zip->status == ZIPARCHIVE::ER_OK) {
3637
?>
3738
--CLEAN--
3839
<?php
39-
$dirname = dirname(__FILE__) . '/';
40-
unlink($dirname . '__tmp_oo_addglob.zip');
40+
$dirname = __DIR__ . '/oo_addglob_dir/';
41+
unlink($dirname . 'tmp.zip');
4142
unlink($dirname . 'foo.txt');
4243
unlink($dirname . 'bar.baz');
44+
rmdir($dirname);
4345
?>
4446
--EXPECT--
4547
0 bar

0 commit comments

Comments
 (0)