summaryrefslogtreecommitdiff
path: root/ext/standard/tests/assert/assert.phpt
blob: 21924902a89e30cf8ce4377a1a651ca784aa2414 (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
30
31
32
33
34
35
36
37
38
39
--TEST--
assert()
--POST--
--GET--
--FILE--
<?php
function a($file,$line,$myev)
{ 
	echo "assertion failed $line,\"$myev\"\n";
}

class a
{
	function assert($file,$line,$myev)
	{
		echo "class assertion failed $line,\"$myev\"\n";
	}
}

assert_options(ASSERT_ACTIVE,1);
assert_options(ASSERT_QUIET_EVAL,1);
assert_options(ASSERT_WARNING,0);

$a = 0;

assert_options(ASSERT_CALLBACK,"a");
assert('$a != 0');

assert_options(ASSERT_CALLBACK,array("a","assert"));
assert('$a != 0');

$obj = new a();
assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
assert('$a != 0');
?>
--EXPECT--
assertion failed 22,"$a != 0"
class assertion failed 25,"$a != 0"
class assertion failed 29,"$a != 0"