xref: /PHP-5.6/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 signal %s
33bool(false)
34
35Warning: pcntl_signal(): Invalid signal %s
36bool(false)
37
38Warning: pcntl_signal(): not callable is not a callable function name error in %s
39bool(false)
40ok
41