Annotation of embedaddon/php/ext/standard/tests/file/stat_variation5-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test stat() functions: usage variations - file opened in read/write mode
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 stats of file opened in write mode and then same in read mode */
18:
19: $file_path = dirname(__FILE__);
20: require "$file_path/file.inc";
21:
22:
23: $file_handle = fopen("$file_path/stat_variation5.tmp", "w"); // temp file
24: fclose($file_handle);
25:
26:
27: echo "\n*** Testing stat(): on a file with read/write permission ***\n";
28:
29: $filename = "$file_path/stat_variation5.tmp";
30: $file_handle = fopen($filename, "w"); // create file
31: fclose($file_handle);
32: $old_stat = stat($filename);
33: // clear the stat
34: clearstatcache();
35: sleep(2);
36: // opening file again in read mode
37: $file_handle = fopen($filename, "r"); // read file
38: fclose($file_handle);
39: $new_stat = stat($filename);
40: // compare self stats
41: var_dump( compare_self_stat($old_stat) );
42: var_dump( compare_self_stat($new_stat) );
43: // compare the stat
44: $affected_members = array(10, 'ctime');
45: var_dump( compare_stats($old_stat, $new_stat, $affected_members, "=") );
46: // clear the stat
47: clearstatcache();
48:
49:
50: echo "\n*** Done ***";
51: ?>
52:
53: --CLEAN--
54: <?php
55: $file_path = dirname(__FILE__);
56: unlink("$file_path/stat_variation5.tmp");
57: ?>
58: --EXPECTF--
59:
60: *** Testing stat(): on a file with read/write permission ***
61: bool(true)
62: bool(true)
63: bool(true)
64:
65: *** Done ***
66:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>