Annotation of embedaddon/php/ext/standard/tests/dir/scandir_error1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test scandir() function : error conditions - Incorrect number of args
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
! 6: * Description: List files & directories inside the specified path
! 7: * Source code: ext/standard/dir.c
! 8: */
! 9:
! 10: /*
! 11: * Pass incorrect number of arguments to scandir() to test behaviour
! 12: */
! 13:
! 14: echo "*** Testing scandir() : error conditions ***\n";
! 15:
! 16: // Zero arguments
! 17: echo "\n-- Testing scandir() function with Zero arguments --\n";
! 18: var_dump( scandir() );
! 19:
! 20: //Test scandir with one more than the expected number of arguments
! 21: echo "\n-- Testing scandir() function with more than expected no. of arguments --\n";
! 22: $dir = dirname(__FILE__) . '/scandir_error';
! 23: mkdir($dir);
! 24: $sorting_order = 10;
! 25: $context = stream_context_create();
! 26: $extra_arg = 10;
! 27: var_dump( scandir($dir, $sorting_order, $context, $extra_arg) );
! 28: ?>
! 29: ===DONE===
! 30: --CLEAN--
! 31: <?php
! 32: $directory = dirname(__FILE__) . '/scandir_error';
! 33: rmdir($directory);
! 34: ?>
! 35: --EXPECTF--
! 36: *** Testing scandir() : error conditions ***
! 37:
! 38: -- Testing scandir() function with Zero arguments --
! 39:
! 40: Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d
! 41: NULL
! 42:
! 43: -- Testing scandir() function with more than expected no. of arguments --
! 44:
! 45: Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d
! 46: NULL
! 47: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>