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