]> granicus.if.org Git - php/commitdiff
MFH: add new tests written by Felipe Pena
authorAntony Dovgal <tony2001@php.net>
Thu, 13 Dec 2007 13:51:15 +0000 (13:51 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 13 Dec 2007 13:51:15 +0000 (13:51 +0000)
Zend/tests/constructor_args.phpt [new file with mode: 0644]
Zend/tests/inter_01.phpt [new file with mode: 0644]
Zend/tests/inter_02.phpt [new file with mode: 0644]

diff --git a/Zend/tests/constructor_args.phpt b/Zend/tests/constructor_args.phpt
new file mode 100644 (file)
index 0000000..8056874
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Different numbers of arguments in __construct()
+--FILE--
+<?php
+interface foobar {
+    function __construct();
+}
+abstract class bar implements foobar {
+    public function __construct($x = 1) {
+    }
+}
+final class foo extends bar implements foobar {
+    public function __construct($x = 1, $y = 2) {
+    }
+}
+new foo;
+print "ok!";
+?>
+--EXPECT--
+ok!
diff --git a/Zend/tests/inter_01.phpt b/Zend/tests/inter_01.phpt
new file mode 100644 (file)
index 0000000..db2e86d
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Inherited constant from interface 
+--FILE--
+<?php
+interface foo {
+    const foo = 'foobar';
+    public function bar($x = foo);
+}
+
+class foobar implements foo {
+    const foo = 'bar';
+    public function bar($x = foo::foo) {
+        var_dump($x);
+    }    
+}
+?>
+--EXPECTF--
+Fatal error: Cannot inherit previously-inherited constant foo from interface foo in %s on line %d
diff --git a/Zend/tests/inter_02.phpt b/Zend/tests/inter_02.phpt
new file mode 100644 (file)
index 0000000..18db230
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Namespace constant as value default
+--FILE--
+<?php
+
+namespace foo;
+
+error_reporting(E_ALL);
+
+interface foo {
+    const foo = 2;
+}
+
+function foo($x = foo::foo::foo) {
+    var_dump($x);
+}
+
+foo();
+?>
+--EXPECT--
+int(2)