]> granicus.if.org Git - php/commitdiff
- New tests
authorFelipe Pena <felipe@php.net>
Mon, 25 Aug 2008 19:35:10 +0000 (19:35 +0000)
committerFelipe Pena <felipe@php.net>
Mon, 25 Aug 2008 19:35:10 +0000 (19:35 +0000)
Zend/tests/bug45910.phpt [new file with mode: 0644]
Zend/tests/constants_007.phpt [new file with mode: 0644]
Zend/tests/constants_008.phpt [new file with mode: 0644]
Zend/tests/constants_009.phpt [new file with mode: 0644]
Zend/tests/inter_007.phpt [new file with mode: 0644]

diff --git a/Zend/tests/bug45910.phpt b/Zend/tests/bug45910.phpt
new file mode 100644 (file)
index 0000000..1041877
--- /dev/null
@@ -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 (file)
index 0000000..90a9975
--- /dev/null
@@ -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--
+unicode(1) "a"
+unicode(1) "b"
+unicode(1) "c"
+unicode(1) "d"
diff --git a/Zend/tests/constants_008.phpt b/Zend/tests/constants_008.phpt
new file mode 100644 (file)
index 0000000..226e147
--- /dev/null
@@ -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 (file)
index 0000000..c84760b
--- /dev/null
@@ -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 (file)
index 0000000..ee62063
--- /dev/null
@@ -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