]> granicus.if.org Git - php/commitdiff
New tests
authorFelipe Pena <felipe@php.net>
Tue, 11 Mar 2008 15:18:58 +0000 (15:18 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 11 Mar 2008 15:18:58 +0000 (15:18 +0000)
Zend/tests/class_constants_004.phpt [new file with mode: 0644]
Zend/tests/objects_017.phpt [new file with mode: 0644]
Zend/tests/objects_018.phpt [new file with mode: 0644]

diff --git a/Zend/tests/class_constants_004.phpt b/Zend/tests/class_constants_004.phpt
new file mode 100644 (file)
index 0000000..a4abf69
--- /dev/null
@@ -0,0 +1,42 @@
+--TEST--
+Testing constants (normal, namespace, class and interface)
+--FILE--
+<?php
+
+namespace foo;
+
+define('foo', 3);
+
+const foo = 1;
+
+class foo {
+       const foo = 2;
+}
+
+interface Ifoo {
+       const foo = 4;
+}
+
+$const  = __NAMESPACE__ .'::foo';  // class
+$const2 = __NAMESPACE__ .'::Ifoo'; // interface
+
+var_dump(      foo,
+                       foo::foo, 
+                       namespace::foo, 
+                       foo::foo::foo, 
+                       $const::foo,
+                       ::foo,
+                       constant('foo'),
+                       Ifoo::foo                       
+                       );
+
+?>
+--EXPECT--
+int(1)
+int(1)
+int(1)
+int(2)
+int(2)
+int(3)
+int(3)
+int(4)
diff --git a/Zend/tests/objects_017.phpt b/Zend/tests/objects_017.phpt
new file mode 100644 (file)
index 0000000..6303030
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Testing visibility of object returned by function
+--FILE--
+<?php
+
+class foo {
+       private $test = 1;
+}
+
+function test() {
+       return new foo;
+}
+
+test()->test = 2;
+
+?>
+--EXPECTF--
+Fatal error: Cannot access private property foo::$test in %s on line %d
diff --git a/Zend/tests/objects_018.phpt b/Zend/tests/objects_018.phpt
new file mode 100644 (file)
index 0000000..5a24f4d
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Using the same function name on interface with inheritance
+--FILE--
+<?php
+
+interface Itest {
+       function a();
+}
+
+interface Itest2 {
+       function a();
+}
+
+interface Itest3 extends Itest, Itest2 {
+}
+
+?>
+--EXPECTF--
+Fatal error: Can't inherit abstract function Itest2::a() (previously declared abstract in Itest) in %s on line %d