1--TEST--
2Test lstat() and stat() functions: usage variations - deleting file/subdir
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip.. Not valid for Windows');
7}
8?>
9--FILE--
10<?php
11/* Prototype: array lstat ( string $filename );
12   Description: Gives information about a file or symbolic link
13
14   Prototype: array stat ( string $filename );
15   Description: Gives information about a file
16*/
17
18$file_path = dirname(__FILE__);
19require "$file_path/file.inc";
20
21/* test the effects on stats by deleting file/subdir from a dir
22*/
23
24echo "*** Testing stat() for comparing stats after the deletion of subdir and file ***\n";
25
26/* first create the dir/subdir and files, record the stat */
27@rmdir("$file_path/lstat_stat_variation9/");  // ensure that dir doesn't exists
28mkdir("$file_path/lstat_stat_variation9/");  // temp dir
29
30// creating and deleting subdir and files in the dir
31$dirname = "$file_path/lstat_stat_variation9";
32@rmdir("$dirname/lstat_stat_variation9_subdir"); // ensure that dir doesn't exists
33mkdir("$dirname/lstat_stat_variation9_subdir");
34$file_handle = fopen("$dirname/lstat_stat_variation9a.tmp", "w");
35fclose($file_handle);
36
37$old_stat = stat($dirname);
38
39/* now delete the surdir and file and record the stat */
40unlink("$dirname/lstat_stat_variation9a.tmp");
41rmdir("$dirname/lstat_stat_variation9_subdir");
42
43// comparing stats after the deletion of subdir and file
44$new_stat = stat($dirname);
45// compare self stats
46var_dump( compare_self_stat($old_stat) );
47var_dump( compare_self_stat($new_stat) );
48
49// compare the stats
50$affected_members = array(3, 'nlink');
51var_dump(compare_stats($old_stat, $new_stat, $affected_members, ">"));
52
53echo "\n--- Done ---";
54?>
55
56--CLEAN--
57<?php
58$file_path = dirname(__FILE__);
59$dirname = "$file_path/lstat_stat_variation9";
60rmdir($dirname);
61?>
62--EXPECTF--
63*** Testing stat() for comparing stats after the deletion of subdir and file ***
64bool(true)
65bool(true)
66bool(true)
67
68--- Done ---
69