File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file / is_file_basic.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:03 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Test is_file() function: basic functionality
--FILE--
<?php
/* Prototype: bool is_file ( string $filename );
   Description: Tells whether the filename is a regular file
     Returns TRUE if the filename exists and is a regular file
*/

echo "*** Testing is_file(): basic functionality ***\n";

/* Checking with current file */
var_dump( is_file(__FILE__) );

/* Checking with (current) dir */
var_dump( is_file(dirname(__FILE__)) );

$file_path = dirname(__FILE__);
$file_name = $file_path."/is_file_basic.tmp";
/* With non-existing file */
var_dump( is_file($file_name) );
/* With existing file */
fclose( fopen($file_name, "w") );
var_dump( is_file($file_name) );

echo "*** Testing is_file() for its return value type ***\n";
var_dump( is_bool( is_file(__FILE__) ) );
var_dump( is_bool( is_file("/no/such/file") ) );

echo "\n*** Done ***";
?>
--CLEAN--
<?php
$file_path = dirname(__FILE__);
$file_name = $file_path."/is_file_basic.tmp";
unlink($file_name);
?>
--EXPECTF--
*** Testing is_file(): basic functionality ***
bool(true)
bool(false)
bool(false)
bool(true)
*** Testing is_file() for its return value type ***
bool(true)
bool(true)

*** Done ***

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>