15 changed files with 643 additions and 0 deletions
-
29ext/reflection/tests/reflectionClass_getName_basic.phpt
-
23ext/reflection/tests/reflectionClass_getName_error.phpt
-
10ext/reflection/tests/reflectionClass_getName_error1.phpt
-
72ext/reflection/tests/reflectionClass_isInstance_basic.phpt
-
60ext/reflection/tests/reflectionClass_isInstance_error.phpt
-
46ext/reflection/tests/reflectionClass_isInstantiable_basic.phpt
-
25ext/reflection/tests/reflectionClass_isInstantiable_error.phpt
-
58ext/reflection/tests/reflectionClass_isInstantiable_variation.phpt
-
28ext/reflection/tests/reflectionClass_isInternal_basic.phpt
-
20ext/reflection/tests/reflectionClass_isInternal_error.phpt
-
179ext/reflection/tests/reflectionClass_isSubclassOf_basic.phpt
-
23ext/reflection/tests/reflectionClass_isSubclassOf_error.phpt
-
22ext/reflection/tests/reflectionClass_isSubclassOf_error1.phpt
-
28ext/reflection/tests/reflectionClass_isUserDefined_basic.phpt
-
20ext/reflection/tests/reflectionClass_isUserDefined_error.phpt
@ -0,0 +1,29 @@ |
|||
--TEST-- |
|||
ReflectionClass::getName() |
|||
--FILE-- |
|||
<?php |
|||
class TrickClass { |
|||
function __toString() { |
|||
//Return the name of another class |
|||
return "Exception"; |
|||
} |
|||
} |
|||
|
|||
$r1 = new ReflectionClass("stdClass"); |
|||
|
|||
$myInstance = new stdClass; |
|||
$r2 = new ReflectionClass($myInstance); |
|||
|
|||
$r3 = new ReflectionClass("TrickClass"); |
|||
|
|||
var_dump($r1->getName(), $r2->getName(), $r3->getName()); |
|||
|
|||
?> |
|||
--EXPECTF-- |
|||
string(8) "stdClass" |
|||
string(8) "stdClass" |
|||
string(10) "TrickClass" |
|||
--UEXPECTF-- |
|||
unicode(8) "stdClass" |
|||
unicode(8) "stdClass" |
|||
unicode(10) "TrickClass" |
|||
@ -0,0 +1,23 @@ |
|||
--TEST-- |
|||
ReflectionClass::getName() - invalid params |
|||
--FILE-- |
|||
<?php |
|||
|
|||
$r1 = new ReflectionClass("stdClass"); |
|||
|
|||
var_dump($r1->getName('X')); |
|||
var_dump($r1->getName('X', true)); |
|||
?> |
|||
--EXPECTF-- |
|||
Warning: Wrong parameter count for ReflectionClass::getName() in %s on line 5 |
|||
NULL |
|||
|
|||
Warning: Wrong parameter count for ReflectionClass::getName() in %s on line 6 |
|||
NULL |
|||
--UEXPECTF-- |
|||
Warning: Wrong parameter count for ReflectionClass::getName() in %s on line 5 |
|||
NULL |
|||
|
|||
Warning: Wrong parameter count for ReflectionClass::getName() in %s on line 6 |
|||
NULL |
|||
|
|||
@ -0,0 +1,10 @@ |
|||
--TEST-- |
|||
ReflectionClass::getName - forbid static invocation |
|||
--FILE-- |
|||
<?php |
|||
ReflectionClass::getName(); |
|||
?> |
|||
--EXPECTF-- |
|||
Fatal error: Non-static method ReflectionClass::getName() cannot be called statically in %s on line 2 |
|||
--UEXPECTF-- |
|||
Fatal error: Non-static method ReflectionClass::getName() cannot be called statically in %s on line 2 |
|||
@ -0,0 +1,72 @@ |
|||
--TEST-- |
|||
ReflectionClass::isInstance() |
|||
--FILE-- |
|||
<?php |
|||
class A {} |
|||
class B extends A {} |
|||
|
|||
interface I {} |
|||
class C implements I {} |
|||
|
|||
class X {} |
|||
|
|||
$classes = array("A", "B", "C", "I", "X"); |
|||
|
|||
$instances = array( "myA" => new A, |
|||
"myB" => new B, |
|||
"myC" => new C, |
|||
"myX" => new X ); |
|||
|
|||
foreach ($classes as $class) { |
|||
$rc = new ReflectionClass($class); |
|||
|
|||
foreach ($instances as $name => $instance) { |
|||
echo "is $name a $class? "; |
|||
var_dump($rc->isInstance($instance)); |
|||
} |
|||
|
|||
} |
|||
|
|||
?> |
|||
--EXPECTF-- |
|||
is myA a A? bool(true) |
|||
is myB a A? bool(false) |
|||
is myC a A? bool(false) |
|||
is myX a A? bool(false) |
|||
is myA a B? bool(false) |
|||
is myB a B? bool(true) |
|||
is myC a B? bool(false) |
|||
is myX a B? bool(false) |
|||
is myA a C? bool(false) |
|||
is myB a C? bool(false) |
|||
is myC a C? bool(true) |
|||
is myX a C? bool(false) |
|||
is myA a I? bool(false) |
|||
is myB a I? bool(false) |
|||
is myC a I? bool(false) |
|||
is myX a I? bool(false) |
|||
is myA a X? bool(false) |
|||
is myB a X? bool(false) |
|||
is myC a X? bool(false) |
|||
is myX a X? bool(true) |
|||
--UEXPECTF-- |
|||
is myA a A? bool(true) |
|||
is myB a A? bool(false) |
|||
is myC a A? bool(false) |
|||
is myX a A? bool(false) |
|||
is myA a B? bool(false) |
|||
is myB a B? bool(true) |
|||
is myC a B? bool(false) |
|||
is myX a B? bool(false) |
|||
is myA a C? bool(false) |
|||
is myB a C? bool(false) |
|||
is myC a C? bool(true) |
|||
is myX a C? bool(false) |
|||
is myA a I? bool(false) |
|||
is myB a I? bool(false) |
|||
is myC a I? bool(false) |
|||
is myX a I? bool(false) |
|||
is myA a X? bool(false) |
|||
is myB a X? bool(false) |
|||
is myC a X? bool(false) |
|||
is myX a X? bool(true) |
|||
@ -0,0 +1,60 @@ |
|||
--TEST-- |
|||
ReflectionClass::isInstance() - invalid params |
|||
--FILE-- |
|||
<?php |
|||
class X {} |
|||
|
|||
$rc = new ReflectionClass("X"); |
|||
$instance = new X; |
|||
|
|||
var_dump($rc->isInstance()); |
|||
var_dump($rc->isInstance($instance, $instance)); |
|||
var_dump($rc->isInstance(1)); |
|||
var_dump($rc->isInstance(1.5)); |
|||
var_dump($rc->isInstance(true)); |
|||
var_dump($rc->isInstance('X')); |
|||
var_dump($rc->isInstance(null)); |
|||
|
|||
?> |
|||
--EXPECTF-- |
|||
Warning: ReflectionClass::isInstance() expects exactly 1 parameter, 0 given in %s on line 7 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects exactly 1 parameter, 2 given in %s on line 8 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, %s given in %s on line 9 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, double given in %s on line 10 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, boolean given in %s on line 11 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, string given in %s on line 12 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, null given in %s on line 13 |
|||
NULL |
|||
--UEXPECTF-- |
|||
Warning: ReflectionClass::isInstance() expects exactly 1 parameter, 0 given in %s on line 7 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects exactly 1 parameter, 2 given in %s on line 8 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, %s given in %s on line 9 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, double given in %s on line 10 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, boolean given in %s on line 11 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, Unicode string given in %s on line 12 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isInstance() expects parameter 1 to be object, null given in %s on line 13 |
|||
NULL |
|||
@ -0,0 +1,46 @@ |
|||
--TEST-- |
|||
ReflectionClass::IsInstantiable() |
|||
--FILE-- |
|||
<?php |
|||
class C { |
|||
} |
|||
|
|||
interface iface { |
|||
function f1(); |
|||
} |
|||
|
|||
class ifaceImpl implements iface { |
|||
function f1() {} |
|||
} |
|||
|
|||
abstract class abstractClass { |
|||
function f1() {} |
|||
abstract function f2(); |
|||
} |
|||
|
|||
class D extends abstractClass { |
|||
function f2() {} |
|||
} |
|||
|
|||
$classes = array("C", "iface", "ifaceImpl", "abstractClass", "D"); |
|||
|
|||
foreach($classes as $class ) { |
|||
$reflectionClass = new ReflectionClass($class); |
|||
echo "Is $class instantiable? "; |
|||
var_dump($reflectionClass->IsInstantiable()); |
|||
|
|||
} |
|||
|
|||
?> |
|||
--EXPECTF-- |
|||
Is C instantiable? bool(true) |
|||
Is iface instantiable? bool(false) |
|||
Is ifaceImpl instantiable? bool(true) |
|||
Is abstractClass instantiable? bool(false) |
|||
Is D instantiable? bool(true) |
|||
--UEXPECTF-- |
|||
Is C instantiable? bool(true) |
|||
Is iface instantiable? bool(false) |
|||
Is ifaceImpl instantiable? bool(true) |
|||
Is abstractClass instantiable? bool(false) |
|||
Is D instantiable? bool(true) |
|||
@ -0,0 +1,25 @@ |
|||
--TEST-- |
|||
ReflectionClass::IsInstantiable() |
|||
--FILE-- |
|||
<?php |
|||
class privateCtorOld { |
|||
private function privateCtorOld() {} |
|||
} |
|||
$reflectionClass = new ReflectionClass("privateCtorOld"); |
|||
|
|||
var_dump($reflectionClass->IsInstantiable('X')); |
|||
var_dump($reflectionClass->IsInstantiable(0, null)); |
|||
|
|||
?> |
|||
--EXPECTF-- |
|||
Warning: Wrong parameter count for ReflectionClass::isInstantiable() in %s on line 7 |
|||
NULL |
|||
|
|||
Warning: Wrong parameter count for ReflectionClass::isInstantiable() in %s on line 8 |
|||
NULL |
|||
--UEXPECTF-- |
|||
Warning: Wrong parameter count for ReflectionClass::isInstantiable() in %s on line 7 |
|||
NULL |
|||
|
|||
Warning: Wrong parameter count for ReflectionClass::isInstantiable() in %s on line 8 |
|||
NULL |
|||
@ -0,0 +1,58 @@ |
|||
--TEST-- |
|||
ReflectionClass::IsInstantiable() |
|||
--FILE-- |
|||
<?php |
|||
class noCtor { |
|||
} |
|||
|
|||
class publicCtorNew { |
|||
public function __construct() {} |
|||
} |
|||
|
|||
class protectedCtorNew { |
|||
protected function __construct() {} |
|||
} |
|||
|
|||
class privateCtorNew { |
|||
private function __construct() {} |
|||
} |
|||
|
|||
class publicCtorOld { |
|||
public function publicCtorOld() {} |
|||
} |
|||
|
|||
class protectedCtorOld { |
|||
protected function protectedCtorOld() {} |
|||
} |
|||
|
|||
class privateCtorOld { |
|||
private function privateCtorOld() {} |
|||
} |
|||
|
|||
|
|||
$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew", |
|||
"publicCtorOld", "protectedCtorOld", "privateCtorOld"); |
|||
|
|||
foreach($classes as $class ) { |
|||
$reflectionClass = new ReflectionClass($class); |
|||
echo "Is $class instantiable? "; |
|||
var_dump($reflectionClass->IsInstantiable()); |
|||
} |
|||
|
|||
?> |
|||
--EXPECTF-- |
|||
Is noCtor instantiable? bool(true) |
|||
Is publicCtorNew instantiable? bool(true) |
|||
Is protectedCtorNew instantiable? bool(false) |
|||
Is privateCtorNew instantiable? bool(false) |
|||
Is publicCtorOld instantiable? bool(true) |
|||
Is protectedCtorOld instantiable? bool(false) |
|||
Is privateCtorOld instantiable? bool(false) |
|||
--UEXPECTF-- |
|||
Is noCtor instantiable? bool(true) |
|||
Is publicCtorNew instantiable? bool(true) |
|||
Is protectedCtorNew instantiable? bool(false) |
|||
Is privateCtorNew instantiable? bool(false) |
|||
Is publicCtorOld instantiable? bool(true) |
|||
Is protectedCtorOld instantiable? bool(false) |
|||
Is privateCtorOld instantiable? bool(false) |
|||
@ -0,0 +1,28 @@ |
|||
--TEST-- |
|||
ReflectionClass::isInternal() |
|||
--FILE-- |
|||
<?php |
|||
class C { |
|||
} |
|||
|
|||
$r1 = new ReflectionClass("stdClass"); |
|||
$r2 = new ReflectionClass("ReflectionClass"); |
|||
$r3 = new ReflectionClass("ReflectionProperty"); |
|||
$r4 = new ReflectionClass("Exception"); |
|||
$r5 = new ReflectionClass("C"); |
|||
|
|||
var_dump($r1->isInternal(), $r2->isInternal(), $r3->isInternal(), |
|||
$r4->isInternal(), $r5->isInternal()); |
|||
?> |
|||
--EXPECTF-- |
|||
bool(true) |
|||
bool(true) |
|||
bool(true) |
|||
bool(true) |
|||
bool(false) |
|||
--UEXPECTF-- |
|||
bool(true) |
|||
bool(true) |
|||
bool(true) |
|||
bool(true) |
|||
bool(false) |
|||
@ -0,0 +1,20 @@ |
|||
--TEST-- |
|||
ReflectionClass::isInternal() - invalid params |
|||
--FILE-- |
|||
<?php |
|||
$r1 = new ReflectionClass("stdClass"); |
|||
var_dump($r1->isInternal('X')); |
|||
var_dump($r1->isInternal('X', true)); |
|||
?> |
|||
--EXPECTF-- |
|||
Warning: Wrong parameter count for ReflectionClass::isInternal() in %s on line 3 |
|||
NULL |
|||
|
|||
Warning: Wrong parameter count for ReflectionClass::isInternal() in %s on line 4 |
|||
NULL |
|||
--UEXPECTF-- |
|||
Warning: Wrong parameter count for ReflectionClass::isInternal() in %s on line 3 |
|||
NULL |
|||
|
|||
Warning: Wrong parameter count for ReflectionClass::isInternal() in %s on line 4 |
|||
NULL |
|||
@ -0,0 +1,179 @@ |
|||
--TEST-- |
|||
ReflectionClass::isSubclassOf() |
|||
--FILE-- |
|||
<?php |
|||
class A {} |
|||
class B extends A {} |
|||
class C extends B {} |
|||
|
|||
interface I {} |
|||
class X implements I {} |
|||
|
|||
$classNames = array('A', 'B', 'C', 'I', 'X'); |
|||
|
|||
foreach ($classNames as $className) { |
|||
$rcs[$className] = new ReflectionClass($className); |
|||
} |
|||
|
|||
foreach ($rcs as $childName => $child) { |
|||
foreach ($rcs as $parentName => $parent) { |
|||
echo "Is " . $childName . " a subclass of " . $parentName . "? \n"; |
|||
echo " - Using object argument: "; |
|||
var_dump($child->isSubclassOf($parent)); |
|||
echo " - Using string argument: "; |
|||
var_dump($child->isSubclassOf($parentName)); |
|||
} |
|||
} |
|||
?> |
|||
--EXPECTF-- |
|||
Is A a subclass of A? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is A a subclass of B? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is A a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is A a subclass of I? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is A a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is B a subclass of A? |
|||
- Using object argument: bool(true) |
|||
- Using string argument: bool(true) |
|||
Is B a subclass of B? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is B a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is B a subclass of I? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is B a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is C a subclass of A? |
|||
- Using object argument: bool(true) |
|||
- Using string argument: bool(true) |
|||
Is C a subclass of B? |
|||
- Using object argument: bool(true) |
|||
- Using string argument: bool(true) |
|||
Is C a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is C a subclass of I? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is C a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of A? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of B? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of I? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is X a subclass of A? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is X a subclass of B? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is X a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is X a subclass of I? |
|||
- Using object argument: bool(true) |
|||
- Using string argument: bool(true) |
|||
Is X a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
--UEXPECTF-- |
|||
Is A a subclass of A? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is A a subclass of B? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is A a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is A a subclass of I? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is A a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is B a subclass of A? |
|||
- Using object argument: bool(true) |
|||
- Using string argument: bool(true) |
|||
Is B a subclass of B? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is B a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is B a subclass of I? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is B a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is C a subclass of A? |
|||
- Using object argument: bool(true) |
|||
- Using string argument: bool(true) |
|||
Is C a subclass of B? |
|||
- Using object argument: bool(true) |
|||
- Using string argument: bool(true) |
|||
Is C a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is C a subclass of I? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is C a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of A? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of B? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of I? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is I a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is X a subclass of A? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is X a subclass of B? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is X a subclass of C? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
Is X a subclass of I? |
|||
- Using object argument: bool(true) |
|||
- Using string argument: bool(true) |
|||
Is X a subclass of X? |
|||
- Using object argument: bool(false) |
|||
- Using string argument: bool(false) |
|||
@ -0,0 +1,23 @@ |
|||
--TEST-- |
|||
ReflectionClass::isSubclassOf() - invalid number of parameters |
|||
--FILE-- |
|||
<?php |
|||
class A {} |
|||
$rc = new ReflectionClass('A'); |
|||
|
|||
var_dump($rc->isSubclassOf()); |
|||
var_dump($rc->isSubclassOf('A',5)); |
|||
|
|||
?> |
|||
--EXPECTF-- |
|||
Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 5 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 6 |
|||
NULL |
|||
--UEXPECTF-- |
|||
Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 5 |
|||
NULL |
|||
|
|||
Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 6 |
|||
NULL |
|||
@ -0,0 +1,22 @@ |
|||
--TEST-- |
|||
ReflectionClass::isSubclassOf() - non-existent class error |
|||
--FILE-- |
|||
<?php |
|||
class A {} |
|||
$rc = new ReflectionClass('A'); |
|||
|
|||
var_dump($rc->isSubclassOf('X')); |
|||
|
|||
?> |
|||
--EXPECTF-- |
|||
Fatal error: Uncaught exception 'ReflectionException' with message 'Class X does not exist' in %s:5 |
|||
Stack trace: |
|||
#0 %s(5): ReflectionClass->isSubclassOf('X') |
|||
#1 {main} |
|||
thrown in %s on line 5 |
|||
--UEXPECTF-- |
|||
Fatal error: Uncaught exception 'ReflectionException' with message 'Class X does not exist' in %s:5 |
|||
Stack trace: |
|||
#0 %s(5): ReflectionClass->isSubclassOf('X') |
|||
#1 {main} |
|||
thrown in %s on line 5 |
|||
@ -0,0 +1,28 @@ |
|||
--TEST-- |
|||
ReflectionClass::isUserDefined() |
|||
--FILE-- |
|||
<?php |
|||
class C { |
|||
} |
|||
|
|||
$r1 = new ReflectionClass("stdClass"); |
|||
$r2 = new ReflectionClass("ReflectionClass"); |
|||
$r3 = new ReflectionClass("ReflectionProperty"); |
|||
$r4 = new ReflectionClass("Exception"); |
|||
$r5 = new ReflectionClass("C"); |
|||
|
|||
var_dump($r1->isUserDefined(), $r2->isUserDefined(), $r3->isUserDefined(), |
|||
$r4->isUserDefined(), $r5->isUserDefined()); |
|||
?> |
|||
--EXPECTF-- |
|||
bool(false) |
|||
bool(false) |
|||
bool(false) |
|||
bool(false) |
|||
bool(true) |
|||
--UEXPECTF-- |
|||
bool(false) |
|||
bool(false) |
|||
bool(false) |
|||
bool(false) |
|||
bool(true) |
|||
@ -0,0 +1,20 @@ |
|||
--TEST-- |
|||
ReflectionClass::isUserDefined() - invalid params. |
|||
--FILE-- |
|||
<?php |
|||
$r1 = new ReflectionClass("stdClass"); |
|||
var_dump($r1->isUserDefined('X')); |
|||
var_dump($r1->isUserDefined('X', true)); |
|||
?> |
|||
--EXPECTF-- |
|||
Warning: Wrong parameter count for ReflectionClass::isUserDefined() in %s on line 3 |
|||
NULL |
|||
|
|||
Warning: Wrong parameter count for ReflectionClass::isUserDefined() in %s on line 4 |
|||
NULL |
|||
--UEXPECTF-- |
|||
Warning: Wrong parameter count for ReflectionClass::isUserDefined() in %s on line 3 |
|||
NULL |
|||
|
|||
Warning: Wrong parameter count for ReflectionClass::isUserDefined() in %s on line 4 |
|||
NULL |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue