Annotation of embedaddon/php/ext/standard/tests/file/unlink_variation2.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 Linux');
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 which is in use ***\n";
20: // temp file name used here
21: $filename = "$file_path/unlink_variation2.tmp";
22:
23: // create file
24: $fp = fopen($filename, "w");
25: // try unlink() on $filename
26: var_dump( unlink($filename) ); // expected: true on linux
27: var_dump( file_exists($filename) ); // confirm file is deleted
28: // now close file handle
29: fclose($fp);
30:
31: echo "Done\n";
32: ?>
33: --EXPECTF--
34: *** Testing unlink() on a file which is in use ***
35: bool(true)
36: bool(false)
37: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>