|
2 | 2 |
|
3 | 3 | require_once __DIR__ . '/_common.php'; |
4 | 4 |
|
| 5 | +if (PHP_VERSION_ID >= 70100) { |
| 6 | + $argumentCountErrorName = "ArgumentCountError"; |
| 7 | +} else { |
| 8 | + $argumentCountErrorName = "TypeError"; |
| 9 | +} |
| 10 | + |
5 | 11 | assert_eq(integrate_arguments_null(null), null); |
6 | | -assert_throw(function () { integrate_arguments_null(); }, "ArgumentCountError", 0, "integrate_arguments_null(): expects at least 1 parameter(s), 0 given"); |
| 12 | + |
| 13 | +assert_throw(function () { integrate_arguments_null(); }, $argumentCountErrorName, 0, "integrate_arguments_null(): expects at least 1 parameter(s), 0 given"); |
7 | 14 | assert_throw(function () { integrate_arguments_null(1); }, "TypeError", 0, "type error: must be of type null, int given"); |
8 | 15 |
|
9 | 16 | assert_eq(integrate_arguments_long(1, 2), 3); |
|
25 | 32 | assert_object(integrate_arguments_object($obj), "stdClass", ["a" => 1, "foo" => "bar"]); |
26 | 33 | assert_throw(function () { integrate_arguments_object(1); }, "TypeError", 0, "type error: must be of type object, int given"); |
27 | 34 |
|
28 | | -assert_throw(function () { integrate_arguments_optional(); }, "ArgumentCountError", 0, "integrate_arguments_optional(): expects at least 1 parameter(s), 0 given"); |
| 35 | +assert_throw(function () { integrate_arguments_optional(); }, $argumentCountErrorName, 0, "integrate_arguments_optional(): expects at least 1 parameter(s), 0 given"); |
29 | 36 | assert_eq(integrate_arguments_optional("foo"), "foo: false"); |
30 | 37 | assert_eq(integrate_arguments_optional("foo", true), "foo: true"); |
31 | 38 | assert_eq(integrate_arguments_optional("foo", true, "bar"), "foo: true"); |
0 commit comments