diff options
| -rw-r--r-- | Zend/tests/bug45910.phpt | 28 | ||||
| -rw-r--r-- | Zend/tests/constants_007.phpt | 22 | ||||
| -rw-r--r-- | Zend/tests/constants_008.phpt | 17 | ||||
| -rw-r--r-- | Zend/tests/constants_009.phpt | 23 | ||||
| -rw-r--r-- | Zend/tests/inter_007.phpt | 20 |
5 files changed, 110 insertions, 0 deletions
diff --git a/Zend/tests/bug45910.phpt b/Zend/tests/bug45910.phpt new file mode 100644 index 0000000000..1041877fee --- /dev/null +++ b/Zend/tests/bug45910.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #45910 (Cannot declare self-referencing constant) +--FILE-- +<?php + +class foo { + const AAA = 'x'; + const BBB = 'a'; + const CCC = 'a'; + const DDD = self::AAA; + + private static $foo = array( + self::BBB => 'a', + self::CCC => 'b', + self::DDD => self::AAA + ); + + public static function test() { + self::$foo; + } +} + +foo::test(); + +print 1; +?> +--EXPECT-- +1 diff --git a/Zend/tests/constants_007.phpt b/Zend/tests/constants_007.phpt new file mode 100644 index 0000000000..7d9f3feb72 --- /dev/null +++ b/Zend/tests/constants_007.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing const names +--FILE-- +<?php + +const a = 'a'; +const A = 'b'; + + +class a { + const a = 'c'; + const A = 'd'; +} + +var_dump(a, A, a::a, a::A); + +?> +--EXPECT-- +string(1) "a" +string(1) "b" +string(1) "c" +string(1) "d" diff --git a/Zend/tests/constants_008.phpt b/Zend/tests/constants_008.phpt new file mode 100644 index 0000000000..226e147ffd --- /dev/null +++ b/Zend/tests/constants_008.phpt @@ -0,0 +1,17 @@ +--TEST-- +Defining constant twice with two different forms +--FILE-- +<?php + +define('a', 2); +const a = 1; + + +if (defined('a')) { + print a; +} + +?> +--EXPECTF-- +Notice: Constant a already defined in %s on line %d +2 diff --git a/Zend/tests/constants_009.phpt b/Zend/tests/constants_009.phpt new file mode 100644 index 0000000000..c84760be81 --- /dev/null +++ b/Zend/tests/constants_009.phpt @@ -0,0 +1,23 @@ +--TEST-- +Accessing constants inside namespace +--FILE-- +<?php + +namespace foo::x; + +const x = 2; + +class x { + const x = 1; +} + + +var_dump(namespace::x, x::x, namespace::x::x); +var_dump(defined('foo::x::x')); + +?> +--EXPECT-- +int(2) +int(1) +int(1) +bool(true) diff --git a/Zend/tests/inter_007.phpt b/Zend/tests/inter_007.phpt new file mode 100644 index 0000000000..ee62063daf --- /dev/null +++ b/Zend/tests/inter_007.phpt @@ -0,0 +1,20 @@ +--TEST-- +Trying inherit abstract function twice +--FILE-- +<?php + +interface d { + static function B(); +} + +interface c { + function b(); +} + +class_alias('c', 'w'); + +interface a extends d, w { } + +?> +--EXPECTF-- +Fatal error: Can't inherit abstract function c::B() (previously declared abstract in d) in %s on line %d |
