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