com php-src: Make zip oo_addpattern test more robust: ext/zip/tests/oo_addpattern.phpt
| From: | Nikita Popov | Date: | Wed, 20 Feb 2019 11:06:02 +0000 |
| Subject: | com php-src: Make zip oo_addpattern test more robust: ext/zip/tests/oo_addpattern.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104777@lists.php.net to get a copy of this message | ||
Commit: 991ea9cc602d93247d35a1ce94b060f58bcd8205
Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 20 Feb 2019 12:06:02 +0100
Parents: a92db42568d5be412fd536cc96475f0a61666223
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=991ea9cc602d93247d35a1ce94b060f58bcd8205
Log:
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.
Changed paths:
M ext/zip/tests/oo_addpattern.phpt
Diff:
diff --git a/ext/zip/tests/oo_addpattern.phpt b/ext/zip/tests/oo_addpattern.phpt
index 73806d5..193f828 100644
--- a/ext/zip/tests/oo_addpattern.phpt
+++ b/ext/zip/tests/oo_addpattern.phpt
@@ -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