"Fossies" - the Fresh Open Source Software Archive

Member "php-7.4.1/ext/reflection/tests/001.phpt" (17 Dec 2019, 1677 Bytes) of package /linux/www/php-7.4.1.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. 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::export',
   26   'UMLClass::__construct',
   27   'UMLClass::__toString',
   28   'UMLClass::getName',
   29   'UMLClass::isInternal',
   30   'UMLClass::isUserDefined',
   31   'UMLClass::isInstantiable',
   32   'UMLClass::getFileName',
   33   'UMLClass::getStartLine',
   34   'UMLClass::getEndLine',
   35   'UMLClass::getDocComment',
   36   'UMLClass::getConstructor',
   37   'UMLClass::getMethod',
   38   'UMLClass::getMethods',
   39   'UMLClass::getProperty',
   40   'UMLClass::getProperties',
   41   'UMLClass::getConstants',
   42   'UMLClass::getConstant',
   43   'UMLClass::getInterfaces',
   44   'UMLClass::isInterface',
   45   'UMLClass::isAbstract',
   46   'UMLClass::isFinal',
   47   'UMLClass::getModifiers',
   48   'UMLClass::isInstance',
   49   'UMLClass::newInstance',
   50   'UMLClass::getParentClass',
   51   'UMLClass::isSubclassOf',
   52   'UMLClass::getStaticProperties',
   53   'UMLClass::getDefaultProperties',
   54   'UMLClass::isIterateable',
   55   'UMLClass::implementsInterface',
   56   'UMLClass::getExtension',
   57   'UMLClass::getExtensionName');
   58 
   59 $miss = array();
   60 
   61 $res = $r->getMethodNames();
   62 
   63 foreach($exp as $m)
   64 {
   65 	if (!in_array($m, $exp))
   66 	{
   67 		$miss[] = $m;
   68 	}
   69 }
   70 
   71 var_dump($miss);
   72 
   73 $props = array_keys(get_class_vars('ReflectionClassEx'));
   74 sort($props);
   75 var_dump($props);
   76 var_dump($r->name);
   77 ?>
   78 ===DONE===
   79 --EXPECT--
   80 array(0) {
   81 }
   82 array(2) {
   83   [0]=>
   84   string(3) "bla"
   85   [1]=>
   86   string(4) "name"
   87 }
   88 string(17) "ReflectionClassEx"
   89 ===DONE===