1--TEST--
2Test posix_kill() function : error conditions
3--SKIPIF--
4<?php
5	if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
6?>
7--FILE--
8<?php
9/* Prototype  : proto bool posix_kill(int pid, int sig)
10 * Description: Send a signal to a process (POSIX.1, 3.3.2)
11 * Source code: ext/posix/posix.c
12 * Alias to functions:
13 */
14
15
16echo "*** Testing posix_kill() : error conditions ***\n";
17
18
19echo "\n-- Testing posix_kill() function with more than expected no. of arguments --\n";
20$pid = posix_getpid();
21$sig = 9;
22$extra_arg = 10;
23var_dump( posix_kill($pid, $sig, $extra_arg) );
24
25echo "\n-- Testing posix_kill() function with less than expected no. of arguments --\n";
26$pid = posix_getpid();
27var_dump( posix_kill($pid) );
28
29echo "\n-- Testing posix_kill() function with invalid signal --\n";
30$pid = posix_getpid();
31$sig = 999;
32var_dump( posix_kill($pid, 999) );
33
34echo "\n-- Testing posix_kill() function with negative pid --\n";
35$pid = -999;
36$sig = 9;
37var_dump( posix_kill($pid, 999) );
38
39echo "Done";
40?>
41--EXPECTF--
42*** Testing posix_kill() : error conditions ***
43
44-- Testing posix_kill() function with more than expected no. of arguments --
45
46Warning: posix_kill() expects exactly 2 parameters, 3 given in %s on line %d
47bool(false)
48
49-- Testing posix_kill() function with less than expected no. of arguments --
50
51Warning: posix_kill() expects exactly 2 parameters, 1 given in %s on line %d
52bool(false)
53
54-- Testing posix_kill() function with invalid signal --
55bool(false)
56
57-- Testing posix_kill() function with negative pid --
58bool(false)
59Done
60