Annotation of embedaddon/php/ext/standard/tests/file/basename_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test basename() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : string basename(string path [, string suffix])
6: * Description: Returns the filename component of the path
7: * Source code: ext/standard/string.c
8: * Alias to functions:
9: */
10:
11: echo "*** Testing basename() : error conditions ***\n";
12:
13: // Zero arguments
14: echo "\n-- Testing basename() function with Zero arguments --\n";
15: var_dump( basename() );
16:
17: //Test basename with one more than the expected number of arguments
18: echo "\n-- Testing basename() function with more than expected no. of arguments --\n";
19: $path = 'string_val';
20: $suffix = 'string_val';
21: $extra_arg = 10;
22: var_dump( basename($path, $suffix, $extra_arg) );
23:
24: ?>
25: ===DONE===
26: --EXPECTF--
27: *** Testing basename() : error conditions ***
28:
29: -- Testing basename() function with Zero arguments --
30:
31: Warning: basename() expects at least 1 parameter, 0 given in %s on line %d
32: NULL
33:
34: -- Testing basename() function with more than expected no. of arguments --
35:
36: Warning: basename() expects at most 2 parameters, 3 given in %s on line %d
37: NULL
38: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>