File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file / is_dir_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_dir() function: basic functionality
--FILE--
<?php
/* Prototype: bool is_dir ( 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_dir(): basic functionality ***\n";
$file_path = dirname(__FILE__);
var_dump( is_dir($file_path) );
clearstatcache();
var_dump( is_dir(".") );
var_dump( is_dir(__FILE__) );  // expected: bool(false)

$dir_name = $file_path."/is_dir_basic";
mkdir($dir_name);
var_dump( is_dir($dir_name) );

echo "*** Testing is_dir() for its return value type ***\n";
var_dump( is_bool( is_dir($file_path) ) );
var_dump( is_bool( is_dir("/no/such/dir") ) );

echo "*** Done ***";
?>
--CLEAN--
<?php
$file_path = dirname(__FILE__);
$dir_name = $file_path."/is_dir_basic";
rmdir($dir_name);
?>

--EXPECTF--
*** Testing is_dir(): basic functionality ***
bool(true)
bool(true)
bool(false)
bool(true)
*** Testing is_dir() for its return value type ***
bool(true)
bool(true)
*** Done ***

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