Annotation of embedaddon/php/ext/standard/tests/dir/readdir_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test readdir() function : error conditions - Incorrect number of args
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : string readdir([resource $dir_handle])
! 6: * Description: Read directory entry from dir_handle
! 7: * Source code: ext/standard/dir.c
! 8: */
! 9:
! 10: /*
! 11: * Pass incorrect number of arguments to readdir() to test behaviour
! 12: */
! 13:
! 14: echo "*** Testing readdir() : error conditions ***\n";
! 15:
! 16:
! 17: //Test readdir with one more than the expected number of arguments
! 18: echo "\n-- Testing readdir() function with more than expected no. of arguments --\n";
! 19:
! 20: $path = dirname(__FILE__) . "/readdir_error";
! 21: mkdir($path);
! 22: $dir_handle = opendir($path);
! 23: $extra_arg = 10;
! 24:
! 25: var_dump( readdir($dir_handle, $extra_arg) );
! 26:
! 27: // close the handle so can remove dir in CLEAN section
! 28: closedir($dir_handle);
! 29: ?>
! 30: ===DONE===
! 31: --CLEAN--
! 32: <?php
! 33: $path = dirname(__FILE__) . "/readdir_error";
! 34: rmdir($path);
! 35: ?>
! 36: --EXPECTF--
! 37: *** Testing readdir() : error conditions ***
! 38:
! 39: -- Testing readdir() function with more than expected no. of arguments --
! 40:
! 41: Warning: readdir() expects at most 1 parameter, 2 given in %s on line %d
! 42: NULL
! 43: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>