Annotation of embedaddon/php/ext/standard/tests/file/is_dir_variation3.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test is_dir() function: usage variations - invalid arguments 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype: bool is_dir ( string $dirname );
                      6:    Description: Tells whether the dirname is a directory
                      7:      Returns TRUE if the dirname exists and is a directory, FALSE  otherwise.
                      8: */
                      9: 
                     10: /* Passing invalid arguments to is_dir() */
                     11: 
                     12: $dir_handle = opendir( dirname(__FILE__) );
                     13: 
                     14: echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n";
                     15: $dirnames = array(
                     16:   /* Invalid dirnames */
                     17:   -2.34555,
                     18:   TRUE,
                     19:   FALSE,
                     20:   NULL,
                     21:   " ",
                     22:   $dir_handle,
                     23: 
                     24:   /* scalars */
                     25:   0,
                     26:   1234
                     27: );
                     28: 
                     29: /* loop through to test each element the above array */
                     30: foreach($dirnames as $dirname) {
                     31:   var_dump( is_dir($dirname) );
                     32: }
                     33: closedir($dir_handle);
                     34: 
                     35: echo "\n*** Done ***";
                     36: ?>
                     37: --EXPECTF--
                     38: *** Testing is_dir() with Invalid arguments: expected bool(false) ***
                     39: bool(false)
                     40: bool(false)
                     41: bool(false)
                     42: bool(false)
                     43: bool(false)
                     44: 
1.1.1.2 ! misho      45: Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d
1.1       misho      46: NULL
                     47: bool(false)
                     48: bool(false)
                     49: 
                     50: *** Done ***
                     51: 

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