Return to method_exists_002.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests |
1.1 ! misho 1: --TEST-- ! 2: Testing method_exists() ! 3: --FILE-- ! 4: <?php ! 5: ! 6: class bar { ! 7: static public function stat_a2() { ! 8: } ! 9: static private function stat_b2() { ! 10: } ! 11: static protected function stat_c2() { ! 12: } ! 13: ! 14: private function method_a() { ! 15: } ! 16: protected function method_b() { ! 17: } ! 18: public function method_c() { ! 19: } ! 20: } ! 21: ! 22: ! 23: ! 24: class baz extends bar { ! 25: static public function stat_a() { ! 26: } ! 27: static private function stat_b() { ! 28: } ! 29: static protected function stat_c() { ! 30: } ! 31: ! 32: private function method_a() { ! 33: } ! 34: protected function method_b() { ! 35: } ! 36: public function method_c() { ! 37: } ! 38: } ! 39: ! 40: var_dump(method_exists('baz', 'stat_a')); ! 41: var_dump(method_exists('baz', 'stat_b')); ! 42: var_dump(method_exists('baz', 'stat_c')); ! 43: print "----\n"; ! 44: var_dump(method_exists('baz', 'stat_a2')); ! 45: var_dump(method_exists('baz', 'stat_b2')); ! 46: var_dump(method_exists('baz', 'stat_c2')); ! 47: print "----\n"; ! 48: ! 49: $baz = new baz; ! 50: var_dump(method_exists($baz, 'method_a')); ! 51: var_dump(method_exists($baz, 'method_b')); ! 52: var_dump(method_exists($baz, 'method_c')); ! 53: print "----\n"; ! 54: var_dump(method_exists($baz, 'stat_a')); ! 55: var_dump(method_exists($baz, 'stat_b')); ! 56: var_dump(method_exists($baz, 'stat_c')); ! 57: ! 58: ?> ! 59: --EXPECT-- ! 60: bool(true) ! 61: bool(true) ! 62: bool(true) ! 63: ---- ! 64: bool(true) ! 65: bool(true) ! 66: bool(true) ! 67: ---- ! 68: bool(true) ! 69: bool(true) ! 70: bool(true) ! 71: ---- ! 72: bool(true) ! 73: bool(true) ! 74: bool(true)