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