Annotation of embedaddon/php/ext/standard/tests/file/fileperms_variation2.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test fileperms() function: usage variations - invalid filenames
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --FILE--
6: <?php
7: /* Prototype: int fileperms ( string $filename )
8: * Description: Returns the group ID of the file, or FALSE in case of an error.
9: */
10:
11: /* Testing fileperms() with invalid arguments -int, float, bool, NULL, resource */
12:
13: $file_path = dirname(__FILE__);
14: $file_handle = fopen($file_path."/fileperms_variation2.tmp", "w");
15:
16: echo "*** Testing Invalid file types ***\n";
17: $filenames = array(
18: /* Invalid filenames */
19: -2.34555,
20: " ",
21: "",
22: TRUE,
23: FALSE,
24: NULL,
25: $file_handle,
26:
27: /* scalars */
28: 1234,
29: 0
30: );
31:
32: /* loop through to test each element the above array */
33: foreach( $filenames as $filename ) {
34: var_dump( fileperms($filename) );
35: clearstatcache();
36: }
37: fclose($file_handle);
38:
39: echo "\n*** Done ***";
40: ?>
41: --CLEAN--
42: <?php
43: $file_path = dirname(__FILE__);
44: unlink($file_path."/fileperms_variation2.tmp");
45: ?>
46: --EXPECTF--
47: *** Testing Invalid file types ***
48:
49: Warning: fileperms(): stat failed for -2.34555 in %s on line %d
50: bool(false)
51:
52: Warning: fileperms(): stat failed for in %s on line %d
53: bool(false)
54: bool(false)
55:
56: Warning: fileperms(): stat failed for 1 in %s on line %d
57: bool(false)
58: bool(false)
59: bool(false)
60:
1.1.1.2 ! misho 61: Warning: fileperms() expects parameter 1 to be a valid path, resource given in %s on line %d
1.1 misho 62: NULL
63:
64: Warning: fileperms(): stat failed for 1234 in %s on line %d
65: bool(false)
66:
67: Warning: fileperms(): stat failed for 0 in %s on line %d
68: bool(false)
69:
70: *** Done ***
71:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>