From: Lars Strojny Date: Thu, 12 Jun 2008 20:31:06 +0000 (+0000) Subject: Reflection::getModifierNames()-test by Felix De Vliegher (Testfest) X-Git-Tag: BEFORE_NEW_PARAMETER_PARSE~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=45f85f3840ac848c5d63a19d6fa53bda24ca4cc5;p=php Reflection::getModifierNames()-test by Felix De Vliegher (Testfest) --- diff --git a/ext/reflection/tests/reflectionClass_getModifierNames_basic.phpt b/ext/reflection/tests/reflectionClass_getModifierNames_basic.phpt new file mode 100644 index 0000000000..91a0a18f1a --- /dev/null +++ b/ext/reflection/tests/reflectionClass_getModifierNames_basic.phpt @@ -0,0 +1,139 @@ +--TEST-- +ReflectionClass::getModifierNames() basic tests +--CREDITS-- +Felix De Vliegher +--FILE-- +getName(), Reflection::getModifierNames($obj->getModifiers())); +} + +function dump_methodModifierNames($class) { + $obj = new ReflectionClass($class); + foreach($obj->getMethods() as $method) { + var_dump($obj->getName() . "::" . $method->getName(), Reflection::getModifierNames($method->getModifiers())); + } +} + +dump_modifierNames('a'); +dump_modifierNames('b'); +dump_modifierNames('c'); + +dump_methodModifierNames('x'); +dump_methodModifierNames('y'); + +?> +==DONE== +--EXPECT-- +string(1) "a" +array(0) { +} +string(1) "b" +array(1) { + [0]=> + string(8) "abstract" +} +string(1) "c" +array(1) { + [0]=> + string(5) "final" +} +string(14) "x::__construct" +array(1) { + [0]=> + string(6) "public" +} +string(13) "x::__destruct" +array(1) { + [0]=> + string(6) "public" +} +string(4) "x::a" +array(1) { + [0]=> + string(7) "private" +} +string(4) "x::b" +array(2) { + [0]=> + string(7) "private" + [1]=> + string(6) "static" +} +string(4) "x::c" +array(1) { + [0]=> + string(9) "protected" +} +string(4) "x::d" +array(2) { + [0]=> + string(9) "protected" + [1]=> + string(6) "static" +} +string(4) "x::e" +array(1) { + [0]=> + string(6) "public" +} +string(4) "x::f" +array(2) { + [0]=> + string(6) "public" + [1]=> + string(6) "static" +} +string(4) "x::g" +array(2) { + [0]=> + string(5) "final" + [1]=> + string(6) "public" +} +string(4) "x::h" +array(1) { + [0]=> + string(6) "public" +} +string(4) "y::a" +array(2) { + [0]=> + string(8) "abstract" + [1]=> + string(6) "public" +} +string(4) "y::b" +array(2) { + [0]=> + string(8) "abstract" + [1]=> + string(9) "protected" +} +==DONE==