Annotation of embedaddon/php/ext/standard/tests/file/fileinode_variation3.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test fileinode() function: usage variations - diff. path notations
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --FILE--
6: <?php
7: /*
8: Prototype: int fileinode ( string $filename );
9: Description: Returns the inode number of the file, or FALSE in case of an error.
10: */
11:
12: /* Passing file names with different notations, using slashes, wild-card chars */
13:
14: $file_path = dirname(__FILE__);
15:
16: echo "*** Testing fileinode() with different notations of file names ***\n";
17: $dir_name = $file_path."/fileinode_variation3";
18: mkdir($dir_name);
19: $file_handle = fopen($dir_name."/fileinode_variation3.tmp", "w");
20: fclose($file_handle);
21:
22: $files_arr = array(
23: "/fileinode_variation3/fileinode_variation3.tmp",
24:
25: /* Testing a file trailing slash */
26: "/fileinode_variation3/fileinode_variation3.tmp/",
27:
28: /* Testing file with double slashes */
29: "/fileinode_variation3//fileinode_variation3.tmp",
30: "//fileinode_variation3//fileinode_variation3.tmp",
31: "/fileinode_variation3/*.tmp",
32: "fileinode_variation3/fileinode*.tmp",
33:
34: /* Testing Binary safe */
35: "/fileinode_variation3/fileinode_variation3.tmp".chr(0),
36: "/fileinode_variation3/fileinode_variation3.tmp\0"
37: );
38:
39: $count = 1;
40: /* loop through to test each element in the above array */
41: foreach($files_arr as $file) {
42: echo "- Iteration $count -\n";
43: var_dump( fileinode( $file_path."/".$file ) );
44: clearstatcache();
45: $count++;
46: }
47:
48: echo "\n*** Done ***";
49: ?>
50: --CLEAN--
51: <?php
52: $file_path = dirname(__FILE__);
53: $dir_name = $file_path."/fileinode_variation3";
54: unlink($dir_name."/fileinode_variation3.tmp");
55: rmdir($dir_name);
56: ?>
57: --EXPECTF--
58: *** Testing fileinode() with different notations of file names ***
59: - Iteration 1 -
1.1.1.2 ! misho 60: int(%i)
1.1 misho 61: - Iteration 2 -
62:
63: Warning: fileinode(): stat failed for %s//fileinode_variation3/fileinode_variation3.tmp/ in %s on line %d
64: bool(false)
65: - Iteration 3 -
1.1.1.2 ! misho 66: int(%i)
1.1 misho 67: - Iteration 4 -
1.1.1.2 ! misho 68: int(%i)
1.1 misho 69: - Iteration 5 -
70:
71: Warning: fileinode(): stat failed for %s//fileinode_variation3/*.tmp in %s on line %d
72: bool(false)
73: - Iteration 6 -
74:
75: Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d
76: bool(false)
77: - Iteration 7 -
1.1.1.2 ! misho 78:
! 79: Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d
! 80: NULL
1.1 misho 81: - Iteration 8 -
1.1.1.2 ! misho 82:
! 83: Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d
! 84: NULL
1.1 misho 85:
86: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>