summaryrefslogtreecommitdiff
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
parent31d77053a14f59748c12afce82d31fb880dbc962 (diff)
downloadphp-git-5b18530e8cc8635592cfb98da0ecbc045c83bfe6.tar.gz
Add test cases for conflicting use and definition in same ns (stas)
-rw-r--r--Zend/tests/use_const/define_imported.phpt14
-rw-r--r--Zend/tests/use_const/define_imported_before.phpt14
-rw-r--r--Zend/tests/use_const/shadow_global_same_ns.phpt21
-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
6 files changed, 56 insertions, 46 deletions
diff --git a/Zend/tests/use_const/define_imported.phpt b/Zend/tests/use_const/define_imported.phpt
new file mode 100644
index 0000000000..5eb44be64a
--- /dev/null
+++ b/Zend/tests/use_const/define_imported.phpt
@@ -0,0 +1,14 @@
+--TEST--
+defining const with same name as imported should fail
+--FILE--
+<?php
+
+namespace {
+ use const foo\bar;
+
+ const bar = 42;
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot declare const bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_const/define_imported_before.phpt b/Zend/tests/use_const/define_imported_before.phpt
new file mode 100644
index 0000000000..19374a2c58
--- /dev/null
+++ b/Zend/tests/use_const/define_imported_before.phpt
@@ -0,0 +1,14 @@
+--TEST--
+using const with same name as defined should fail
+--FILE--
+<?php
+
+namespace {
+ const bar = 42;
+
+ use const foo\bar;
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use const foo\bar as bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_const/shadow_global_same_ns.phpt b/Zend/tests/use_const/shadow_global_same_ns.phpt
deleted file mode 100644
index 7e8a871027..0000000000
--- a/Zend/tests/use_const/shadow_global_same_ns.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-shadowing global constants defined in the same namespace as use
---FILE--
-<?php
-
-namespace foo {
- const bar = 'local';
-}
-
-namespace {
- const bar = 'global';
-
- use const foo\bar;
- var_dump(bar);
- echo "Done\n";
-}
-
-?>
---EXPECT--
-string(5) "local"
-Done
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