Annotation of embedaddon/php/ext/standard/tests/file/unlink_variation2-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test unlink() function : usage variations - unlink file in use
3: --SKIPIF--
4: <?php
5: if (substr(PHP_OS, 0, 3) != 'WIN') {
6: die('skip only on Windows');
7: }
8: ?>
9: --FILE--
10: <?php
11: /* Prototype : bool unlink ( string $filename [, resource $context] );
12: Description : Deletes filename
13: */
14:
15: /* Try to unlink file when file handle is still in use */
16:
17: $file_path = dirname(__FILE__);
18:
19: echo "*** Testing unlink() on a file when file handle is open ***\n";
20: // temp file name used here
21: $filename = "$file_path/unlink_variation2-win32.tmp";
22:
23: // create file
24: $fp = fopen($filename, "w");
25: // try unlink() on $filename
26: var_dump( unlink($filename) ); // expected: false as file handle is still open
27: // now close file handle
28: fclose($fp);
29:
30: // now unlink file
31: var_dump( unlink($filename) ); // expected: true
32: var_dump( file_exists($filename) ); // confirm file is deleted
33:
34: echo "Done\n";
35: ?>
36: --EXPECTF--
37: *** Testing unlink() on a file when file handle is open ***
38:
39: Warning: unlink(%s): %s in %s on line %d
40: bool(false)
41: bool(true)
42: bool(false)
43: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>