Annotation of embedaddon/php/ext/standard/tests/file/is_file_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test is_file() function: basic functionality
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(): basic functionality ***\n";
11:
12: /* Checking with current file */
13: var_dump( is_file(__FILE__) );
14:
15: /* Checking with (current) dir */
16: var_dump( is_file(dirname(__FILE__)) );
17:
18: $file_path = dirname(__FILE__);
19: $file_name = $file_path."/is_file_basic.tmp";
20: /* With non-existing file */
21: var_dump( is_file($file_name) );
22: /* With existing file */
23: fclose( fopen($file_name, "w") );
24: var_dump( is_file($file_name) );
25:
26: echo "*** Testing is_file() for its return value type ***\n";
27: var_dump( is_bool( is_file(__FILE__) ) );
28: var_dump( is_bool( is_file("/no/such/file") ) );
29:
30: echo "\n*** Done ***";
31: ?>
32: --CLEAN--
33: <?php
34: $file_path = dirname(__FILE__);
35: $file_name = $file_path."/is_file_basic.tmp";
36: unlink($file_name);
37: ?>
38: --EXPECTF--
39: *** Testing is_file(): basic functionality ***
40: bool(true)
41: bool(false)
42: bool(false)
43: bool(true)
44: *** Testing is_file() for its return value type ***
45: bool(true)
46: bool(true)
47:
48: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>