summaryrefslogtreecommitdiff
path: root/ext/standard/tests/random/random_int_error.phpt
blob: fe461275c95186c61f0e0213a3d1180feb2660b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--TEST--
Test error operation of random_int()
--FILE--
<?php
//-=-=-=-

try {
    $randomInt = random_int();
} catch (TypeError $e) {
    echo $e->getMessage().PHP_EOL;
}

try {
    $randomInt = random_int(42);
} catch (TypeError $e) {
    echo $e->getMessage().PHP_EOL;
}

try {
    $randomInt = random_int(42,0);
} catch (Error $e) {
    echo $e->getMessage().PHP_EOL;
}

?>
--EXPECT--
random_int() expects exactly 2 arguments, 0 given
random_int() expects exactly 2 arguments, 1 given
random_int(): Argument #1 ($min) must be less than or equal to argument #2 ($max)