]> granicus.if.org Git - php/commitdiff
Make zip oo_addglob test more robust
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 21 Feb 2019 11:19:02 +0000 (12:19 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 21 Feb 2019 11:19:02 +0000 (12:19 +0100)
Use a separate directory for the test, so files created in the main
test directory cannot influence it.

ext/zip/tests/oo_addglob.phpt

index ea21f0161aeb9ed2589c5a560239509a806da1b7..0699797a5dbe864fc03860235a91e044f57151ca 100644 (file)
@@ -11,11 +11,12 @@ if(!defined("GLOB_BRACE")) die ('skip');
 ?>
 --FILE--
 <?php
-$dirname = dirname(__FILE__) . '/';
-include $dirname . 'utils.inc';
-$file = $dirname . '__tmp_oo_addglob.zip';
+include __DIR__ . '/utils.inc';
+$dirname = __DIR__ . '/oo_addglob_dir/';
+$file = $dirname . 'tmp.zip';
 
-copy($dirname . 'test.zip', $file);
+@mkdir($dirname);
+copy(__DIR__ . '/test.zip', $file);
 touch($dirname . 'foo.txt');
 touch($dirname . 'bar.baz');
 
@@ -36,10 +37,11 @@ if ($zip->status == ZIPARCHIVE::ER_OK) {
 ?>
 --CLEAN--
 <?php
-$dirname = dirname(__FILE__) . '/';
-unlink($dirname . '__tmp_oo_addglob.zip');
+$dirname = __DIR__ . '/oo_addglob_dir/';
+unlink($dirname . 'tmp.zip');
 unlink($dirname . 'foo.txt');
 unlink($dirname . 'bar.baz');
+rmdir($dirname);
 ?>
 --EXPECT--
 0 bar