Annotation of embedaddon/php/ext/standard/tests/file/is_file_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test is_file() function: error conditions
3: --FILE--
4: <?php
5: /* Prototype: bool is_file ( string $filename );
6: Description: Tells whether the filename is a regular file
7: Returns TRUE if the filename exists and is a regular file
8: */
9:
10: echo "*** Testing is_file() error conditions ***";
11: $file_path = dirname(__FILE__);
12: var_dump( is_file() ); // Zero No. of args
13:
14: /* no of args > expected */
15: $file_handle = fopen($file_path."/is_file_error.tmp", "w");
16: var_dump( is_file( $file_path."/is_file_error.tmp", $file_path."/is_file_error1.tmp") );
17:
18: /* Non-existing file */
19: var_dump( is_file($file_path."/is_file_error1.tmp") );
20:
21: /* Passing resource as an argument */
22: var_dump( is_file($file_handle) );
23:
24: fclose($file_handle);
25:
26: echo "\n*** Done ***";
27: ?>
28:
29: --CLEAN--
30: <?php
31: $file_path = dirname(__FILE__);
32: if(file_exists($file_path."/is_file_error.tmp")) {
33: unlink($file_path."/is_file_error.tmp");
34: }
35: if(file_exists($file_path."/is_file_error1.tmp")) {
36: unlink($file_path."/is_file_error1.tmp");
37: }
38: ?>
39: --EXPECTF--
40: *** Testing is_file() error conditions ***
41: Warning: is_file() expects exactly 1 parameter, 0 given in %s on line %d
42: NULL
43:
44: Warning: is_file() expects exactly 1 parameter, 2 given in %s on line %d
45: NULL
46: bool(false)
47:
48: Warning: is_file() expects parameter 1 to be string, resource given in %s on line %d
49: NULL
50:
51: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>