Annotation of embedaddon/php/ext/standard/tests/file/stat_variation6-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test stat() functions: usage variations - changing permissions of dir/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 changing permissions of dir/file */
18:
19:
20: $file_path = dirname(__FILE__);
21: require "$file_path/file.inc";
22:
23:
24: /* create temp file and directory */
25: $dirname = "$file_path/stat_variation6";
26: mkdir($dirname); // temp dir
27:
28: $filename = "$file_path/stat_variation6.tmp";
29: $file_handle = fopen($filename, "w"); // temp file
30: fclose($file_handle);
31:
32:
33: // checking stat() on file
34: echo "\n*** Testing stat() on file with miscelleneous file permission and content ***\n";
35: $old_stat = stat($filename);
36: var_dump( chmod($filename, 0777) );
37: // clear the stat
38: clearstatcache();
39: sleep(2);
40: $new_stat = stat($filename);
41: // compare self stats
42: var_dump( compare_self_stat($old_stat) );
43: var_dump( compare_self_stat($new_stat) );
44: // compare the stat
45: $affected_members = array( 10, 'ctime');
46: var_dump( compare_stats($old_stat, $new_stat, $affected_members, "=") );
47: // clear the stat
48: clearstatcache(); // clear statement cache
49:
50: // checking stat() on directory
51: echo "\n*** Testing stat() on directory with miscelleneous file permission ***\n";
52: $old_stat = stat($dirname);
53: var_dump( chmod($dirname, 0777) );
54: // clear the stat
55: clearstatcache();
56: sleep(2);
57: $new_stat = stat($dirname);
58: // compare self stats
59: var_dump( compare_self_stat($old_stat) );
60: var_dump( compare_self_stat($new_stat) );
61: // compare the stat
62: $affected_members = array( 10, 'ctime');
63: var_dump( compare_stats($old_stat, $new_stat, $affected_members, "=") );
64: // clear the stat
65: clearstatcache(); // clear statement cache
66:
67:
68: echo "\n*** Done ***";
69: ?>
70:
71: --CLEAN--
72: <?php
73: $file_path = dirname(__FILE__);
74: unlink("$file_path/stat_variation6.tmp");
75: rmdir("$file_path/stat_variation6");
76: ?>
77: --EXPECTF--
78:
79: *** Testing stat() on file with miscelleneous file permission and content ***
80: bool(true)
81: bool(true)
82: bool(true)
83: bool(true)
84:
85: *** Testing stat() on directory with miscelleneous file permission ***
86: bool(true)
87: bool(true)
88: bool(true)
89: bool(true)
90:
91: *** Done ***
92:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>