xref: /PHP-7.3/ext/standard/tests/assert/assert.phpt (revision 782352c5)
1--TEST--
2assert()
3--INI--
4error_reporting = 2039
5assert.active = 0
6assert.warning = 1
7assert.callback =
8assert.bail = 0
9assert.quiet_eval = 0
10--FILE--
11<?php
12function a($file,$line,$myev)
13{
14	echo "assertion failed $line,\"$myev\"\n";
15}
16
17class a
18{
19	function assert($file,$line,$myev)
20	{
21		echo "class assertion failed $line,\"$myev\"\n";
22	}
23}
24
25assert_options(ASSERT_ACTIVE,1);
26assert_options(ASSERT_QUIET_EVAL,1);
27assert_options(ASSERT_WARNING,0);
28
29$a = 0;
30
31assert_options(ASSERT_CALLBACK,"a");
32assert('$a != 0');
33
34assert_options(ASSERT_CALLBACK,array("a","assert"));
35assert('$a != 0');
36
37$obj = new a();
38assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
39assert('$a != 0');
40?>
41--EXPECT--
42assertion failed 22,"$a != 0"
43class assertion failed 25,"$a != 0"
44class assertion failed 29,"$a != 0"
45