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