xref: /PHP-7.1/ext/reflection/tests/001.phpt (revision 610c7fbe)
1--TEST--
2Reflection inheritance
3--FILE--
4<?php
5
6class 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
63foreach($exp as $m)
64{
65	if (!in_array($m, $exp))
66	{
67		$miss[] = $m;
68	}
69}
70
71var_dump($miss);
72
73$props = array_keys(get_class_vars('ReflectionClassEx'));
74sort($props);
75var_dump($props);
76var_dump($r->name);
77?>
78===DONE===
79--EXPECT--
80array(0) {
81}
82array(2) {
83  [0]=>
84  string(3) "bla"
85  [1]=>
86  string(4) "name"
87}
88string(17) "ReflectionClassEx"
89===DONE===
90