xref: /php-src/Zend/tests/assert/expect_018.phpt (revision 3d4ff5ae)
1--TEST--
2test assertions in namespace
3--INI--
4zend.assertions=1
5--FILE--
6<?php
7namespace Foo;
8
9ini_set("zend.assertions", 0);
10var_dump(\assert(false));
11var_dump(\assert(true));
12var_dump(assert(false));
13var_dump(assert(true));
14ini_set("zend.assertions", 1);
15try {
16    var_dump(\assert(false));
17} catch (\AssertionError $e) {
18    echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
19}
20var_dump(\assert(true));
21try {
22    var_dump(assert(false));
23} catch (\AssertionError $e) {
24    echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
25}
26var_dump(assert(true));
27?>
28--EXPECT--
29bool(true)
30bool(true)
31bool(true)
32bool(true)
33assert(): assert(false) failed
34bool(true)
35assert(): assert(false) failed
36bool(true)
37