]> granicus.if.org Git - php/commitdiff
- New tests
authorFelipe Pena <felipe@php.net>
Fri, 22 Aug 2008 13:40:54 +0000 (13:40 +0000)
committerFelipe Pena <felipe@php.net>
Fri, 22 Aug 2008 13:40:54 +0000 (13:40 +0000)
Zend/tests/get_class_methods_001.phpt [new file with mode: 0644]
Zend/tests/get_class_methods_002.phpt [new file with mode: 0644]
Zend/tests/get_class_methods_003.phpt [new file with mode: 0644]

diff --git a/Zend/tests/get_class_methods_001.phpt b/Zend/tests/get_class_methods_001.phpt
new file mode 100644 (file)
index 0000000..277ea2c
--- /dev/null
@@ -0,0 +1,55 @@
+--TEST--
+get_class_methods(): Testing scope
+--FILE--
+<?php
+
+abstract class A { 
+       public function a() { }
+       private function b() { }
+       protected function c() { }      
+}
+
+class B extends A {
+       private function bb() { }
+       
+       static public function test() { 
+               var_dump(get_class_methods('A'));
+               var_dump(get_class_methods('B'));
+       }
+}
+
+
+var_dump(get_class_methods('A'));
+var_dump(get_class_methods('B'));
+
+
+B::test();
+
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  string(1) "a"
+}
+array(2) {
+  [0]=>
+  string(4) "test"
+  [1]=>
+  string(1) "a"
+}
+array(2) {
+  [0]=>
+  string(1) "a"
+  [1]=>
+  string(1) "c"
+}
+array(4) {
+  [0]=>
+  string(2) "bb"
+  [1]=>
+  string(4) "test"
+  [2]=>
+  string(1) "a"
+  [3]=>
+  string(1) "c"
+}
diff --git a/Zend/tests/get_class_methods_002.phpt b/Zend/tests/get_class_methods_002.phpt
new file mode 100644 (file)
index 0000000..27da6e8
--- /dev/null
@@ -0,0 +1,43 @@
+--TEST--
+get_class_methods(): Testing with interface
+--FILE--
+<?php
+
+interface A { 
+       function a();
+       function b();
+}
+
+class B implements A {
+       public function a() { }
+       public function b() { }
+       
+       public function __construct() {
+               var_dump(get_class_methods('A'));
+               var_dump(get_class_methods('B'));
+       }
+       
+       public function __destruct() { }
+}
+
+new B;
+
+?>
+--EXPECTF--
+Strict Standards: Redefining already defined constructor for class B in %s on line %d
+array(2) {
+  [0]=>
+  string(1) "a"
+  [1]=>
+  string(1) "b"
+}
+array(4) {
+  [0]=>
+  string(1) "a"
+  [1]=>
+  string(1) "b"
+  [2]=>
+  string(11) "__construct"
+  [3]=>
+  string(10) "__destruct"
+}
diff --git a/Zend/tests/get_class_methods_003.phpt b/Zend/tests/get_class_methods_003.phpt
new file mode 100644 (file)
index 0000000..bbb7586
--- /dev/null
@@ -0,0 +1,78 @@
+--TEST--
+get_class_methods(): Testing scope
+--FILE--
+<?php
+
+interface A { 
+       function aa();
+       function bb();
+       static function cc();
+}
+
+class C {
+       public function a() { }
+       protected function b() { }
+       private function c() { }
+       
+       static public function static_a() { }
+       static protected function static_b() { }
+       static private function static_c() { }
+}
+
+class B extends C implements A {
+       public function aa() { }
+       public function bb() { }
+       
+       static function cc() { }
+       
+       public function __construct() {
+               var_dump(get_class_methods('A'));
+               var_dump(get_class_methods('B'));
+               var_dump(get_class_methods('C'));
+       }
+       
+       public function __destruct() { }
+}
+
+new B;
+
+?>
+--EXPECT--
+array(3) {
+  [0]=>
+  string(2) "aa"
+  [1]=>
+  string(2) "bb"
+  [2]=>
+  string(2) "cc"
+}
+array(9) {
+  [0]=>
+  string(2) "aa"
+  [1]=>
+  string(2) "bb"
+  [2]=>
+  string(2) "cc"
+  [3]=>
+  string(11) "__construct"
+  [4]=>
+  string(10) "__destruct"
+  [5]=>
+  string(1) "a"
+  [6]=>
+  string(1) "b"
+  [7]=>
+  string(8) "static_a"
+  [8]=>
+  string(8) "static_b"
+}
+array(4) {
+  [0]=>
+  string(1) "a"
+  [1]=>
+  string(1) "b"
+  [2]=>
+  string(8) "static_a"
+  [3]=>
+  string(8) "static_b"
+}