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.
This commit is contained in:
Nikita Popov 2019-02-20 12:06:02 +01:00
parent a92db42568
commit 991ea9cc60

View File

@ -10,11 +10,13 @@ if(!extension_loaded('zip')) die('skip');
?>
--FILE--
<?php
$dirname = dirname(__FILE__) . '/';
include $dirname . 'utils.inc';
$file = $dirname . '__tmp_oo_addpattern.zip';
include __DIR__ . '/utils.inc';
copy($dirname . 'test.zip', $file);
$dirname = __DIR__ . '/oo_addpattern_dir/';
$file = $dirname . 'tmp.zip';
@mkdir($dirname);
copy(__DIR__ . '/test.zip', $file);
touch($dirname . 'foo.txt');
touch($dirname . 'bar.txt');
@ -36,10 +38,11 @@ if ($zip->status == ZIPARCHIVE::ER_OK) {
?>
--CLEAN--
<?php
$dirname = dirname(__FILE__) . '/';
unlink($dirname . '__tmp_oo_addpattern.zip');
$dirname = dirname(__FILE__) . '/oo_addpattern_dir/';
unlink($dirname . 'tmp.zip');
unlink($dirname . 'foo.txt');
unlink($dirname . 'bar.txt');
rmdir($dirname);
?>
--EXPECT--
0 bar