summaryrefslogtreecommitdiff
path: root/Zend/tests/use_function
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2013-08-22 22:12:34 +0200
committerIgor Wiedler <igor@wiedler.ch>2013-08-23 23:31:17 +0200
commit5b18530e8cc8635592cfb98da0ecbc045c83bfe6 (patch)
tree95c204eebd270c9ea0ba37e00d9ec4d5c6d561a5 /Zend/tests/use_function
parent31d77053a14f59748c12afce82d31fb880dbc962 (diff)
downloadphp-git-5b18530e8cc8635592cfb98da0ecbc045c83bfe6.tar.gz
Add test cases for conflicting use and definition in same ns (stas)
Diffstat (limited to 'Zend/tests/use_function')
-rw-r--r--Zend/tests/use_function/define_imported.phpt14
-rw-r--r--Zend/tests/use_function/define_imported_before.phpt14
-rw-r--r--Zend/tests/use_function/shadow_global_same_ns.phpt25
3 files changed, 28 insertions, 25 deletions
diff --git a/Zend/tests/use_function/define_imported.phpt b/Zend/tests/use_function/define_imported.phpt
new file mode 100644
index 0000000000..c542a4d549
--- /dev/null
+++ b/Zend/tests/use_function/define_imported.phpt
@@ -0,0 +1,14 @@
+--TEST--
+defining function with same name as imported should fail
+--FILE--
+<?php
+
+namespace {
+ use function foo\bar;
+
+ function bar() {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot declare function bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_function/define_imported_before.phpt b/Zend/tests/use_function/define_imported_before.phpt
new file mode 100644
index 0000000000..ff5d5ca28d
--- /dev/null
+++ b/Zend/tests/use_function/define_imported_before.phpt
@@ -0,0 +1,14 @@
+--TEST--
+using function with same name as defined should fail
+--FILE--
+<?php
+
+namespace {
+ function bar() {}
+
+ use function foo\bar;
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use function foo\bar as bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_function/shadow_global_same_ns.phpt b/Zend/tests/use_function/shadow_global_same_ns.phpt
deleted file mode 100644
index 7a30c8238f..0000000000
--- a/Zend/tests/use_function/shadow_global_same_ns.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-shadowing global functions defined in the same namespace as use
---FILE--
-<?php
-
-namespace foo {
- function bar() {
- return 'local';
- }
-}
-
-namespace {
- function bar() {
- return 'global';
- }
-
- use function foo\bar;
- var_dump(bar());
- echo "Done\n";
-}
-
-?>
---EXPECT--
-string(5) "local"
-Done