summaryrefslogtreecommitdiff
path: root/Zend/tests/assert/expect_011.phpt
blob: e68852e69f8cc8f00fc3edb23c14ce5e4a9ca125 (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
--TEST--
test overloaded __toString on custom exception
--INI--
zend.assertions=1
assert.exception=1
--FILE--
<?php
class MyExpectations extends AssertionError {
    public function __toString() {
        return sprintf(
            "[Message]: %s", __CLASS__);
    }
}

class One {
    public function __construct() {
        assert(false, (string) new MyExpectations());
    }
}
class Two extends One {}

new Two();
?>
--EXPECTF--
Fatal error: Uncaught AssertionError: [Message]: MyExpectations in %sexpect_011.php:%d
Stack trace:
#0 %sexpect_011.php(%d): assert(false, '[Message]: MyEx...')
#1 %sexpect_011.php(%d): One->__construct()
#2 {main}
  thrown in %sexpect_011.php on line %d