com php-src: Add test cases for conflicting use and definition in same ns (stas): Zend/tests/use_const/define_imported.phpt Zend/
tests/use_const/define_imported_before.phpt Zend/test s/use_const/shadow_global_same_ns.phpt Zend/tests/u se_function/define_imported.phpt
Zend/tests/use_funct ion/define_imported_before.phpt Zend/tests/use_functi on/shadow_global_same_ns.phpt

From: Date: Fri, 23 Aug 2013 21:31:17 +0000
Subject: com php-src: Add test cases for conflicting use and definition in same ns (stas): Zend/tests/use_const/define_imported.phpt Zend/
tests/use_const/define_imported_before.phpt Zend/test s/use_const/shadow_global_same_ns.phpt Zend/tests/u se_function/define_imported.phpt
Zend/tests/use_funct ion/define_imported_before.phpt Zend/tests/use_functi on/shadow_global_same_ns.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74287@lists.php.net to get a copy of this message
Commit: 5b18530e8cc8635592cfb98da0ecbc045c83bfe6 Author: Igor Wiedler <igor@wiedler.ch> Thu, 22 Aug 2013 22:12:34 +0200 Parents: 31d77053a14f59748c12afce82d31fb880dbc962 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5b18530e8cc8635592cfb98da0ecbc045c83bfe6 Log: Add test cases for conflicting use and definition in same ns (stas) Changed paths: A Zend/tests/use_const/define_imported.phpt A Zend/tests/use_const/define_imported_before.phpt D Zend/tests/use_const/shadow_global_same_ns.phpt A Zend/tests/use_function/define_imported.phpt A Zend/tests/use_function/define_imported_before.phpt D Zend/tests/use_function/shadow_global_same_ns.phpt Diff: diff --git a/Zend/tests/use_const/define_imported..phpt b/Zend/tests/use_const/define_imported.phpt new file mode 100644 index 0000000..5eb44be --- /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 0000000..19374a2 --- /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 7e8a871..0000000 --- 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 0000000..c542a4d --- /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 0000000..ff5d5ca --- /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 7a30c82..0000000 --- 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

« previous php.cvs (#74287) next »