Annotation of embedaddon/php/ext/standard/tests/general_functions/sleep_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test sleep() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : int sleep ( int $seconds )
6: * Description: Delays the program execution for the given number of seconds .
7: * Source code: ext/standard/basic_functions.c
8: */
9: set_time_limit(20);
10:
11: echo "*** Testing sleep() : error conditions ***\n";
12:
13: echo "\n-- Testing sleep() function with zero arguments --\n";
14: var_dump( sleep() );
15:
16: echo "\n-- Testing sleep() function with more than expected no. of arguments --\n";
17: $seconds = 10;
18: $extra_arg = 10;
19: var_dump( sleep($seconds, $extra_arg) );
20:
21: echo "\n-- Testing sleep() function with negative interval --\n";
22: $seconds = -10;
23: var_dump( sleep($seconds) );
24:
25: ?>
26: ===DONE===
27: --EXPECTF--
28: *** Testing sleep() : error conditions ***
29:
30: -- Testing sleep() function with zero arguments --
31:
32: Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d
33: bool(false)
34:
35: -- Testing sleep() function with more than expected no. of arguments --
36:
37: Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d
38: bool(false)
39:
40: -- Testing sleep() function with negative interval --
41:
42: Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d
43: bool(false)
44: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>