Annotation of embedaddon/php/ext/standard/tests/file/stat_variation4-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test stat() functions: usage variations - effects of is_dir() & is_file()
3: --SKIPIF--
4: <?php
5: if (substr(PHP_OS, 0, 3) != 'WIN') {
6: die('skip.. only for Windows');
7: }
8: ?>
9: --FILE--
10: <?php
11:
12: /*
13: * Prototype: array stat ( string $filename );
14: * Description: Gives information about a file
15: */
16:
17: /* test the effects on the stats of dir/file for using is_dir() & is_file() on dir/file */
18:
19: $file_path = dirname(__FILE__);
20: require "$file_path/file.inc";
21:
22:
23: /* create temp file and directory */
24: mkdir("$file_path/stat_variation4/"); // temp dir
25:
26: $file_handle = fopen("$file_path/stat_variation4.tmp", "w"); // temp file
27: fclose($file_handle);
28:
29:
30: echo "\n*** Testing stat(): on file and directory after accessing it
31: with is_dir() and is_file() functions ***\n";
32:
33: // is_dir() on a directory
34: echo "-- Testing on Directory --\n";
35: $old_dirname = "$file_path/stat_variation4";
36: $old_stat = stat($old_dirname);
37: // clear the cache
38: clearstatcache();
39: sleep(2);
40: var_dump( is_dir($old_dirname) );
41: $new_stat = stat($old_dirname);
42:
43: // compare self stats
44: var_dump( compare_self_stat($old_stat) );
45: var_dump( compare_self_stat($new_stat) );
46: // compare the stat
47: var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") );
48: // clear the stat
49: clearstatcache();
50:
51:
52: // is_file() on a file
53: echo "-- Testing on file --\n";
54: $old_filename = "$file_path/stat_variation4.tmp";
55: $old_stat = stat($old_filename);
56: // clear the stat
57: clearstatcache();
58: sleep(2);
59: var_dump( is_file($old_filename) );
60: $new_stat = stat($old_filename);
61: // compare self stats
62: var_dump( compare_self_stat($old_stat) );
63: var_dump( compare_self_stat($new_stat) );
64: // compare the stat
65: var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") );
66: // clear the stat
67: clearstatcache();
68:
69: echo "\n*** Done ***";
70: ?>
71:
72: --CLEAN--
73: <?php
74: $file_path = dirname(__FILE__);
75: unlink("$file_path/stat_variation4.tmp");
76: rmdir("$file_path/stat_variation4");
77: ?>
78: --EXPECTF--
79: *** Testing stat(): on file and directory after accessing it
80: with is_dir() and is_file() functions ***
81: -- Testing on Directory --
82: bool(true)
83: bool(true)
84: bool(true)
85: bool(true)
86: -- Testing on file --
87: bool(true)
88: bool(true)
89: bool(true)
90: bool(true)
91:
92: *** Done ***
93:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>