Annotation of embedaddon/php/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ReflectionClass::IsInstantiable()
! 3: --FILE--
! 4: <?php
! 5: class noCtor {
! 6: }
! 7:
! 8: class publicCtorNew {
! 9: public function __construct() {}
! 10: }
! 11:
! 12: class protectedCtorNew {
! 13: protected function __construct() {}
! 14: }
! 15:
! 16: class privateCtorNew {
! 17: private function __construct() {}
! 18: }
! 19:
! 20: class publicCtorOld {
! 21: public function publicCtorOld() {}
! 22: }
! 23:
! 24: class protectedCtorOld {
! 25: protected function protectedCtorOld() {}
! 26: }
! 27:
! 28: class privateCtorOld {
! 29: private function privateCtorOld() {}
! 30: }
! 31:
! 32:
! 33: $classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew",
! 34: "publicCtorOld", "protectedCtorOld", "privateCtorOld");
! 35:
! 36: foreach($classes as $class ) {
! 37: $reflectionClass = new ReflectionClass($class);
! 38: echo "Is $class instantiable? ";
! 39: var_dump($reflectionClass->IsInstantiable());
! 40: }
! 41:
! 42: ?>
! 43: --EXPECTF--
! 44: Is noCtor instantiable? bool(true)
! 45: Is publicCtorNew instantiable? bool(true)
! 46: Is protectedCtorNew instantiable? bool(false)
! 47: Is privateCtorNew instantiable? bool(false)
! 48: Is publicCtorOld instantiable? bool(true)
! 49: Is protectedCtorOld instantiable? bool(false)
! 50: Is privateCtorOld instantiable? bool(false)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>