xref: /php-src/Zend/tests/015.phpt (revision 7aa2d351)
1--TEST--
2trigger_error() tests
3--FILE--
4<?php
5
6var_dump(trigger_error("error"));
7
8try {
9    var_dump(trigger_error("error", -1));
10} catch (\ValueError $e) {
11    echo $e->getMessage() . \PHP_EOL;
12}
13try {
14    var_dump(trigger_error("error", 0));
15} catch (\ValueError $e) {
16    echo $e->getMessage() . \PHP_EOL;
17}
18
19var_dump(trigger_error("error", E_USER_WARNING));
20var_dump(trigger_error("error", E_USER_DEPRECATED));
21
22?>
23--EXPECTF--
24Notice: error in %s on line %d
25bool(true)
26trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
27trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
28
29Warning: error in %s on line %d
30bool(true)
31
32Deprecated: error in %s on line %d
33bool(true)
34