"Fossies" - the Fresh Open Source Software Archive

Member "php-8.0.28-src/ext/reflection/tests/001.phpt" (14 Feb 2023, 1699 Bytes) of package /windows/www/php-8.0.28-src.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 --TEST--
    2 Reflection inheritance
    3 --FILE--
    4 <?php
    5 
    6 class ReflectionClassEx extends ReflectionClass
    7 {
    8     public $bla;
    9 
   10     function getMethodNames()
   11     {
   12         $res = array();
   13         foreach($this->getMethods() as $m)
   14         {
   15             $res[] = $m->class . '::' . $m->name;
   16         }
   17         return $res;
   18     }
   19 }
   20 
   21 $r = new ReflectionClassEx('ReflectionClassEx');
   22 
   23 $exp = array (
   24   'UMLClass::__clone',
   25   'UMLClass::__construct',
   26   'UMLClass::__toString',
   27   'UMLClass::getName',
   28   'UMLClass::isInternal',
   29   'UMLClass::isUserDefined',
   30   'UMLClass::isInstantiable',
   31   'UMLClass::getFileName',
   32   'UMLClass::getStartLine',
   33   'UMLClass::getEndLine',
   34   'UMLClass::getDocComment',
   35   'UMLClass::getConstructor',
   36   'UMLClass::getMethod',
   37   'UMLClass::getMethods',
   38   'UMLClass::getProperty',
   39   'UMLClass::getProperties',
   40   'UMLClass::getConstants',
   41   'UMLClass::getConstant',
   42   'UMLClass::getInterfaces',
   43   'UMLClass::isInterface',
   44   'UMLClass::isAbstract',
   45   'UMLClass::isFinal',
   46   'UMLClass::getModifiers',
   47   'UMLClass::isInstance',
   48   'UMLClass::newInstance',
   49   'UMLClass::getParentClass',
   50   'UMLClass::isSubclassOf',
   51   'UMLClass::getStaticProperties',
   52   'UMLClass::getDefaultProperties',
   53   'UMLClass::isIterateable',
   54   'UMLClass::implementsInterface',
   55   'UMLClass::getExtension',
   56   'UMLClass::getExtensionName');
   57 
   58 $miss = array();
   59 
   60 $res = $r->getMethodNames();
   61 
   62 foreach($exp as $m)
   63 {
   64     if (!in_array($m, $exp))
   65     {
   66         $miss[] = $m;
   67     }
   68 }
   69 
   70 var_dump($miss);
   71 
   72 $props = array_keys(get_class_vars('ReflectionClassEx'));
   73 sort($props);
   74 var_dump($props);
   75 var_dump($r->name);
   76 ?>
   77 --EXPECT--
   78 array(0) {
   79 }
   80 array(2) {
   81   [0]=>
   82   string(3) "bla"
   83   [1]=>
   84   string(4) "name"
   85 }
   86 string(17) "ReflectionClassEx"