xref: /PHP-5.3/ext/pcntl/tests/pcntl_signal.phpt (revision 10c20cea)
1--TEST--
2pcntl_signal()
3--SKIPIF--
4<?php if (!extension_loaded("pcntl")) print "skip"; ?>
5<?php if (!extension_loaded("posix")) die("skip posix extension not available"); ?>
6--FILE--
7<?php
8pcntl_signal(SIGTERM, function($signo){
9	echo "signal dispatched\n";
10});
11posix_kill(posix_getpid(), SIGTERM);
12pcntl_signal_dispatch();
13
14var_dump(pcntl_signal());
15var_dump(pcntl_signal(SIGALRM, SIG_IGN));
16var_dump(pcntl_signal(-1, -1));
17var_dump(pcntl_signal(-1, function(){}));
18var_dump(pcntl_signal(SIGALRM, "not callable"));
19
20
21/* test freeing queue in RSHUTDOWN */
22posix_kill(posix_getpid(), SIGTERM);
23echo "ok\n";
24?>
25--EXPECTF--
26signal dispatched
27
28Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
29NULL
30bool(true)
31
32Warning: pcntl_signal(): Invalid value for handle argument specified in %s
33
34Warning: pcntl_signal(): Error assigning signal %s
35bool(false)
36
37Warning: pcntl_signal(): Error assigning signal %s
38bool(false)
39
40Warning: pcntl_signal(): not callable is not a callable function name error in %s
41bool(false)
42ok
43