Annotation of embedaddon/php/ext/posix/tests/posix_kill_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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:
16: echo "*** Testing posix_kill() : error conditions ***\n";
17:
18:
19: echo "\n-- Testing posix_kill() function with more than expected no. of arguments --\n";
20: $pid = posix_getpid();
21: $sig = 9;
22: $extra_arg = 10;
23: var_dump( posix_kill($pid, $sig, $extra_arg) );
24:
25: echo "\n-- Testing posix_kill() function with less than expected no. of arguments --\n";
26: $pid = posix_getpid();
27: var_dump( posix_kill($pid) );
28:
29: echo "\n-- Testing posix_kill() function with invalid signal --\n";
30: $pid = posix_getpid();
31: $sig = 999;
32: var_dump( posix_kill($pid, 999) );
33:
34: echo "\n-- Testing posix_kill() function with negative pid --\n";
35: $pid = -999;
36: $sig = 9;
37: var_dump( posix_kill($pid, 999) );
38:
39: echo "Done";
40: ?>
41: --EXPECTF--
42: *** Testing posix_kill() : error conditions ***
43:
44: -- Testing posix_kill() function with more than expected no. of arguments --
45:
46: Warning: posix_kill() expects exactly 2 parameters, 3 given in %s on line %d
47: bool(false)
48:
49: -- Testing posix_kill() function with less than expected no. of arguments --
50:
51: Warning: posix_kill() expects exactly 2 parameters, 1 given in %s on line %d
52: bool(false)
53:
54: -- Testing posix_kill() function with invalid signal --
55: bool(false)
56:
57: -- Testing posix_kill() function with negative pid --
58: bool(false)
59: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>