xref: /PHP-8.3/ext/standard/tests/assert/assert.phpt (revision 3d4ff5ae)
1--TEST--
2assert()
3--INI--
4assert.active = 0
5assert.warning = 1
6assert.callback =
7assert.bail = 0
8assert.exception=0
9--FILE--
10<?php
11function a($file, $line, $unused, $desc)
12{
13    echo "assertion failed $line,\"$desc\"\n";
14}
15
16class a
17{
18    static function assert($file, $line, $unused, $desc)
19    {
20        echo "class assertion failed $line,\"$desc\"\n";
21    }
22}
23
24assert_options(ASSERT_ACTIVE,1);
25assert_options(ASSERT_WARNING,0);
26
27$a = 0;
28
29assert_options(ASSERT_CALLBACK,"a");
30assert($a != 0);
31
32assert_options(ASSERT_CALLBACK,array("a","assert"));
33assert($a != 0);
34
35$obj = new a();
36assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
37assert($a != 0);
38?>
39--EXPECTF--
40Deprecated: PHP Startup: assert.active INI setting is deprecated in Unknown on line 0
41
42Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
43
44Deprecated: Constant ASSERT_ACTIVE is deprecated in %s on line %d
45
46Deprecated: Function assert_options() is deprecated in %s on line %d
47
48Deprecated: Constant ASSERT_WARNING is deprecated in %s on line %d
49
50Deprecated: Function assert_options() is deprecated in %s on line %d
51
52Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
53
54Deprecated: Function assert_options() is deprecated in %s on line %d
55assertion failed 21,"assert($a != 0)"
56
57Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
58
59Deprecated: Function assert_options() is deprecated in %s on line %d
60class assertion failed 24,"assert($a != 0)"
61
62Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
63
64Deprecated: Function assert_options() is deprecated in %s on line %d
65class assertion failed 28,"assert($a != 0)"
66