Annotation of embedaddon/php/ext/standard/tests/file/lstat_stat_variation8.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test lstat() and stat() functions: usage variations - creating file/subdir
3: --SKIPIF--
4: <?php
5: if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6: if (substr(PHP_OS, 0, 3) == 'WIN') {
7: die('skip.. Not valid for Windows');
8: }
9: ?>
10: --FILE--
11: <?php
12: /* Prototype: array lstat ( string $filename );
13: Description: Gives information about a file or symbolic link
14:
15: Prototype: array stat ( string $filename );
16: Description: Gives information about a file
17: */
18:
19: $file_path = dirname(__FILE__);
20: require "$file_path/file.inc";
21:
22: /* test the effects on stats with creating file/subdir in a dir
23: */
24:
25: /* create temp file */
26: mkdir("$file_path/lstat_stat_variation8/"); // temp dir
27:
28: // creating and deleting subdir and files in the dir
29: echo "*** Testing stat() on dir after subdir and file is created in it ***\n";
30: $dirname = "$file_path/lstat_stat_variation8";
31: $old_stat = stat($dirname);
32: clearstatcache();
33: sleep(2);
34: mkdir("$dirname/lstat_stat_variation8_subdir");
35: $file_handle = fopen("$dirname/lstat_stat_variation8a.tmp", "w");
36: fclose($file_handle);
37: $new_stat = stat($dirname);
38:
39: // compare self stats
40: var_dump( compare_self_stat($old_stat) );
41: var_dump( compare_self_stat($new_stat) );
42: // compare the stats
43: $affected_members = array(3, 9, 10, 'nlink', 'mtime', 'ctime');
44: clearstatcache();
45: var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<"));
46:
47: echo "\n--- Done ---";
48: ?>
49: --CLEAN--
50: <?php
51: $file_path = dirname(__FILE__);
52: unlink("$file_path/lstat_stat_variation8/lstat_stat_variation8a.tmp");
53: rmdir("$file_path/lstat_stat_variation8/lstat_stat_variation8_subdir/");
54: rmdir("$file_path/lstat_stat_variation8");
55: ?>
56: --EXPECTF--
57: *** Testing stat() on dir after subdir and file is created in it ***
58: bool(true)
59: bool(true)
60: bool(true)
61:
62: --- Done ---
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>