ru_php/ext/pcntl/tests/pcntl_alarm_invalid_value.phpt

36 lines
691 B
PHP

--TEST--
pcntl_alarm() rejects invalid values
--EXTENSIONS--
pcntl
--SKIPIF--
<?php if (PHP_INT_SIZE < 8) die("skip 64-bit only"); ?>
--FILE--
<?php
try {
pcntl_alarm(-1);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
pcntl_alarm(PHP_INT_MIN);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
pcntl_alarm(PHP_INT_MAX);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
var_dump(pcntl_alarm(0));
?>
--EXPECTF--
pcntl_alarm(): Argument #1 ($seconds) must be between 0 and %d
pcntl_alarm(): Argument #1 ($seconds) must be between 0 and %d
pcntl_alarm(): Argument #1 ($seconds) must be between 0 and %d
int(0)