summaryrefslogtreecommitdiff
path: root/Zend/tests/ns_090.phpt
diff options
context:
space:
mode:
authorMárcio Almada <marcio3w@gmail.com>2015-01-19 02:21:11 -0300
committerMárcio Almada <marcio3w@gmail.com>2015-03-07 17:59:48 -0300
commitbb171e2edcf243eb7d6614dbf1eddd6176b6f438 (patch)
treee6026ba5d1f313490ff317dc8ac980c90cc21a32 /Zend/tests/ns_090.phpt
parent39b0e2c90d7bdc1b37477f48192ad4e96ad2b677 (diff)
downloadphp-git-bb171e2edcf243eb7d6614dbf1eddd6176b6f438.tar.gz
add tests for batch use declarations with classes, functions and constants
Diffstat (limited to 'Zend/tests/ns_090.phpt')
-rw-r--r--Zend/tests/ns_090.phpt48
1 files changed, 48 insertions, 0 deletions
diff --git a/Zend/tests/ns_090.phpt b/Zend/tests/ns_090.phpt
new file mode 100644
index 0000000000..bf460d0352
--- /dev/null
+++ b/Zend/tests/ns_090.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Batch use statements declared inline
+--FILE--
+<?php
+namespace Foo\Bar\Baz {
+ function foo(){echo __FUNCTION__,"\n";}
+ function bar(){echo __FUNCTION__,"\n";}
+ const FOO = 0;
+ const BAR = 1;
+ class A { function __construct() {echo __METHOD__,"\n";} }
+ class B { function __construct() {echo __METHOD__,"\n";} }
+ class C { function __construct() {echo __METHOD__,"\n";} }
+ class D { function __construct() {echo __METHOD__,"\n";} }
+}
+namespace Fiz\Biz\Buz {
+
+ use Foo\Bar\Baz { A, B, C as AC, D };
+ use Foo\Bar\Baz { function foo, function bar as buz, const FOO, const BAR AS BOZ };
+
+ class C { function __construct() {echo __METHOD__,"\n";}}
+ function bar(){echo __FUNCTION__,"\n";}
+ const BAR = 100;
+
+ new A;
+ new B;
+ new AC;
+ new D;
+ new C;
+ foo();
+ buz();
+ bar();
+ var_dump(FOO);
+ var_dump(BOZ);
+ var_dump(BAR);
+}
+
+--EXPECTF--
+Foo\Bar\Baz\A::__construct
+Foo\Bar\Baz\B::__construct
+Foo\Bar\Baz\C::__construct
+Foo\Bar\Baz\D::__construct
+Fiz\Biz\Buz\C::__construct
+Foo\Bar\Baz\foo
+Foo\Bar\Baz\bar
+Fiz\Biz\Buz\bar
+int(0)
+int(1)
+int(100)