xref: /PHP-7.0/Zend/tests/ns_095.phpt (revision 7568d5cb)
1--TEST--
2Absolute namespaces should be allowed
3--FILE--
4<?php
5
6namespace Foo\Bar {
7    class ClassA{}
8    class ClassB{}
9    class ClassC{}
10
11    function fn_a(){ return __FUNCTION__; }
12    function fn_b(){ return __FUNCTION__; }
13    function fn_c(){ return __FUNCTION__; }
14
15    const CONST_A = 1;
16    const CONST_B = 2;
17    const CONST_C = 3;
18}
19
20namespace Baz {
21
22    use \Foo\Bar\{ClassA, ClassB, ClassC};
23    use function \Foo\Bar\{fn_a, fn_b, fn_c};
24    use const \Foo\Bar\{CONST_A, CONST_B, CONST_C};
25
26    var_dump(ClassA::class);
27    var_dump(ClassB::class);
28    var_dump(ClassC::class);
29    var_dump(fn_a());
30    var_dump(fn_b());
31    var_dump(fn_c());
32    var_dump(CONST_A);
33    var_dump(CONST_B);
34    var_dump(CONST_C);
35
36    echo "\nDone\n";
37}
38?>
39--EXPECTF--
40
41string(14) "Foo\Bar\ClassA"
42string(14) "Foo\Bar\ClassB"
43string(14) "Foo\Bar\ClassC"
44string(12) "Foo\Bar\fn_a"
45string(12) "Foo\Bar\fn_b"
46string(12) "Foo\Bar\fn_c"
47int(1)
48int(2)
49int(3)
50
51Done
52