Annotation of embedaddon/php/ext/standard/tests/file/unlink_variation6.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test unlink() function : variation
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --FILE--
6: <?php
7: /* Prototype : bool unlink(string filename[, context context])
8: * Description: Delete a file
9: * Source code: ext/standard/file.c
10: * Alias to functions:
11: */
12:
13: echo "*** Testing unlink() : variation: contexts and relative files ***\n";
14:
15: // test relative directories and stream contexts.
16: $subdir = 'subdir';
17: $testfile = $subdir.'/testfile.txt';
18: mkdir($subdir);
19: touch($testfile);
20: f_exists($testfile);
21: $context = stream_context_create();
22: var_dump(unlink($testfile, $context));
23: f_exists($testfile);
24: rmdir($subdir);
25:
26: function f_exists($file) {
27: if (file_exists($file) == true) {
28: echo "$file exists\n";
29: }
30: else {
31: echo "$file doesn't exist\n";
32: }
33: }
34: ?>
35: ===DONE===
36: --EXPECTF--
37: *** Testing unlink() : variation: contexts and relative files ***
38: subdir/testfile.txt exists
39: bool(true)
40: subdir/testfile.txt doesn't exist
41: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>