Annotation of embedaddon/php/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: ReflectionClass::getModifierNames() basic tests
                      3: --CREDITS--
                      4: Felix De Vliegher <felix.devliegher@gmail.com>
                      5: --FILE--
                      6: <?php
                      7: 
                      8: class a {}
                      9: abstract class b {}
                     10: final class c {}
                     11: 
                     12: class x
                     13: {
                     14:        function __construct() {}
                     15:        function __destruct() {}
                     16:        private function a() {}
                     17:        private static function b() {}
                     18:        protected function c() {}
                     19:        protected static function d() {}
                     20:        public function e() {}
                     21:        public static function f() {}
                     22:        final function g() {}
                     23:        function h() {}
                     24: }
                     25: 
                     26: abstract class y
                     27: {
                     28:        abstract function a();
                     29:        abstract protected function b();
                     30: }
                     31: 
                     32: function dump_modifierNames($class) {
                     33:        $obj = new ReflectionClass($class);
                     34:        var_dump($obj->getName(), Reflection::getModifierNames($obj->getModifiers()));
                     35: }
                     36: 
                     37: function dump_methodModifierNames($class) {
                     38:        $obj = new ReflectionClass($class);
                     39:        foreach($obj->getMethods() as $method) {
                     40:                var_dump($obj->getName() . "::" . $method->getName(), Reflection::getModifierNames($method->getModifiers()));
                     41:        }
                     42: }
                     43: 
                     44: dump_modifierNames('a');
                     45: dump_modifierNames('b');
                     46: dump_modifierNames('c');
                     47: 
                     48: dump_methodModifierNames('x');
                     49: dump_methodModifierNames('y');
                     50: 
                     51: ?>
                     52: ==DONE==
                     53: --EXPECT--
                     54: string(1) "a"
                     55: array(0) {
                     56: }
                     57: string(1) "b"
                     58: array(1) {
                     59:   [0]=>
                     60:   string(8) "abstract"
                     61: }
                     62: string(1) "c"
                     63: array(1) {
                     64:   [0]=>
                     65:   string(5) "final"
                     66: }
                     67: string(14) "x::__construct"
                     68: array(1) {
                     69:   [0]=>
                     70:   string(6) "public"
                     71: }
                     72: string(13) "x::__destruct"
                     73: array(1) {
                     74:   [0]=>
                     75:   string(6) "public"
                     76: }
                     77: string(4) "x::a"
                     78: array(1) {
                     79:   [0]=>
                     80:   string(7) "private"
                     81: }
                     82: string(4) "x::b"
                     83: array(2) {
                     84:   [0]=>
                     85:   string(7) "private"
                     86:   [1]=>
                     87:   string(6) "static"
                     88: }
                     89: string(4) "x::c"
                     90: array(1) {
                     91:   [0]=>
                     92:   string(9) "protected"
                     93: }
                     94: string(4) "x::d"
                     95: array(2) {
                     96:   [0]=>
                     97:   string(9) "protected"
                     98:   [1]=>
                     99:   string(6) "static"
                    100: }
                    101: string(4) "x::e"
                    102: array(1) {
                    103:   [0]=>
                    104:   string(6) "public"
                    105: }
                    106: string(4) "x::f"
                    107: array(2) {
                    108:   [0]=>
                    109:   string(6) "public"
                    110:   [1]=>
                    111:   string(6) "static"
                    112: }
                    113: string(4) "x::g"
                    114: array(2) {
                    115:   [0]=>
                    116:   string(5) "final"
                    117:   [1]=>
                    118:   string(6) "public"
                    119: }
                    120: string(4) "x::h"
                    121: array(1) {
                    122:   [0]=>
                    123:   string(6) "public"
                    124: }
                    125: string(4) "y::a"
                    126: array(2) {
                    127:   [0]=>
                    128:   string(8) "abstract"
                    129:   [1]=>
                    130:   string(6) "public"
                    131: }
                    132: string(4) "y::b"
                    133: array(2) {
                    134:   [0]=>
                    135:   string(8) "abstract"
                    136:   [1]=>
                    137:   string(9) "protected"
                    138: }
                    139: ==DONE==

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>