1--TEST--
2Test 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
11echo "*** Testing sleep() : error conditions ***\n";
12
13echo "\n-- Testing sleep() function with zero arguments --\n";
14var_dump( sleep() );
15
16echo "\n-- Testing sleep() function with more than expected no. of arguments --\n";
17$seconds = 10;
18$extra_arg = 10;
19var_dump( sleep($seconds, $extra_arg) );
20
21echo "\n-- Testing sleep() function with negative interval --\n";
22$seconds = -10;
23var_dump( sleep($seconds) );
24
25?>
26===DONE===
27--EXPECTF--
28*** Testing sleep() : error conditions ***
29
30-- Testing sleep() function with zero arguments --
31
32Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d
33bool(false)
34
35-- Testing sleep() function with more than expected no. of arguments --
36
37Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d
38bool(false)
39
40-- Testing sleep() function with negative interval --
41
42Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d
43bool(false)
44===DONE===
45