summaryrefslogtreecommitdiff
path: root/ext/reflection
diff options
context:
space:
mode:
authorZoe Slattery <zoe@php.net>2007-07-12 21:03:39 +0000
committerZoe Slattery <zoe@php.net>2007-07-12 21:03:39 +0000
commit55ff728d73b950402490b70f3660fbbadf2270a6 (patch)
tree2ed92bfd5c19234ebb1fe737c55fc19302e96b48 /ext/reflection
parentaf88e0b52c5d1121930e0f3de0890566e7bcf13a (diff)
downloadphp-git-55ff728d73b950402490b70f3660fbbadf2270a6.tar.gz
reflectionObject tests
Diffstat (limited to 'ext/reflection')
-rw-r--r--ext/reflection/tests/reflectionObject_FileInfo_basic.phpt25
-rw-r--r--ext/reflection/tests/reflectionObject_FileInfo_error.phpt37
-rw-r--r--ext/reflection/tests/reflectionObject_constructor_basic.phpt28
-rw-r--r--ext/reflection/tests/reflectionObject_constructor_error.phpt49
-rw-r--r--ext/reflection/tests/reflectionObject_getConstant_basic.phpt41
-rw-r--r--ext/reflection/tests/reflectionObject_getConstant_error.phpt34
-rw-r--r--ext/reflection/tests/reflectionObject_getConstants_basic.phpt49
-rw-r--r--ext/reflection/tests/reflectionObject_getConstants_error.phpt18
-rw-r--r--ext/reflection/tests/reflectionObject_getConstructor_basic.phpt82
-rw-r--r--ext/reflection/tests/reflectionObject_getConstructor_error.phpt24
-rw-r--r--ext/reflection/tests/reflectionObject_getName_basic.phpt27
-rw-r--r--ext/reflection/tests/reflectionObject_getName_error.phpt23
-rw-r--r--ext/reflection/tests/reflectionObject_getName_error1.phpt8
-rw-r--r--ext/reflection/tests/reflectionObject_isInstance_basic.phpt33
-rw-r--r--ext/reflection/tests/reflectionObject_isInstance_error.phpt38
-rw-r--r--ext/reflection/tests/reflectionObject_isInstantiable_basic.phpt36
-rw-r--r--ext/reflection/tests/reflectionObject_isInstantiable_error.phpt22
-rw-r--r--ext/reflection/tests/reflectionObject_isInstantiable_variation.phpt78
-rw-r--r--ext/reflection/tests/reflectionObject_isInternal_basic.phpt23
-rw-r--r--ext/reflection/tests/reflectionObject_isInternal_error.phpt15
-rw-r--r--ext/reflection/tests/reflectionObject_isSubclassOf_basic.phpt116
-rw-r--r--ext/reflection/tests/reflectionObject_isSubclassOf_error.phpt24
-rw-r--r--ext/reflection/tests/reflectionObject_isUserDefined_basic.phpt23
-rw-r--r--ext/reflection/tests/reflectionObject_isUserDefined_error.phpt15
24 files changed, 868 insertions, 0 deletions
diff --git a/ext/reflection/tests/reflectionObject_FileInfo_basic.phpt b/ext/reflection/tests/reflectionObject_FileInfo_basic.phpt
new file mode 100644
index 0000000000..a1334f4d65
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_FileInfo_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+ReflectionObject::getFileName(), ReflectionObject::getStartLine(), ReflectionObject::getEndLine() - basic function
+--FILE--
+<?php
+$rc = new ReflectionObject(new C);
+var_dump($rc->getFileName());
+var_dump($rc->getStartLine());
+var_dump($rc->getEndLine());
+
+$rc = new ReflectionObject(new stdclass);
+var_dump($rc->getFileName());
+var_dump($rc->getStartLine());
+var_dump($rc->getEndLine());
+
+Class C {
+
+}
+?>
+--EXPECTF--
+string(%d) "%sreflectionObject_FileInfo_basic.php"
+int(12)
+int(14)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/reflection/tests/reflectionObject_FileInfo_error.phpt b/ext/reflection/tests/reflectionObject_FileInfo_error.phpt
new file mode 100644
index 0000000000..f66d2fb59e
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_FileInfo_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+ReflectionObject::getFileName(), ReflectionObject::getStartLine(), ReflectionObject::getEndLine() -invalid aparams
+--FILE--
+<?php
+Class C { }
+
+$rc = new ReflectionObject(new C);
+$methods = array("getFileName", "getStartLine", "getEndLine");
+
+foreach ($methods as $method) {
+ var_dump($rc->$method());
+ var_dump($rc->$method(null));
+ var_dump($rc->$method('X', 0));
+}
+?>
+--EXPECTF--
+string(%d) "%s"
+
+Warning: Wrong parameter count for ReflectionClass::getFileName() in %s on line 9
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::getFileName() in %s on line 10
+NULL
+int(2)
+
+Warning: Wrong parameter count for ReflectionClass::getStartLine() in %s on line 9
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::getStartLine() in %s on line 10
+NULL
+int(2)
+
+Warning: Wrong parameter count for ReflectionClass::getEndLine() in %s on line 9
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::getEndLine() in %s on line 10
+NULL
diff --git a/ext/reflection/tests/reflectionObject_constructor_basic.phpt b/ext/reflection/tests/reflectionObject_constructor_basic.phpt
new file mode 100644
index 0000000000..8f4a9082c9
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_constructor_basic.phpt
@@ -0,0 +1,28 @@
+--TEST--
+ReflectionObject::__construct - basic function test
+--FILE--
+<?php
+$r1 = new ReflectionObject(new stdClass);
+var_dump($r1);
+
+class C { }
+$myInstance = new C;
+$r2 = new ReflectionObject($myInstance);
+var_dump($r2);
+
+$r3 = new ReflectionObject($r2);
+var_dump($r3);
+?>
+--EXPECTF--
+object(ReflectionObject)#%d (1) {
+ ["name"]=>
+ string(8) "stdClass"
+}
+object(ReflectionObject)#%d (1) {
+ ["name"]=>
+ string(1) "C"
+}
+object(ReflectionObject)#%d (1) {
+ ["name"]=>
+ string(16) "ReflectionObject"
+}
diff --git a/ext/reflection/tests/reflectionObject_constructor_error.phpt b/ext/reflection/tests/reflectionObject_constructor_error.phpt
new file mode 100644
index 0000000000..baa6129edf
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_constructor_error.phpt
@@ -0,0 +1,49 @@
+--TEST--
+ReflectionObject::__construct - invalid arguments
+--FILE--
+<?php
+
+var_dump(new ReflectionObject());
+var_dump(new ReflectionObject('stdClass'));
+$myInstance = new stdClass;
+var_dump(new ReflectionObject($myInstance, $myInstance));
+var_dump(new ReflectionObject(0));
+var_dump(new ReflectionObject(null));
+var_dump(new ReflectionObject(array(1,2)));
+?>
+--EXPECTF--
+Warning: ReflectionObject::__construct() expects exactly 1 parameter, 0 given in %s on line 3
+object(ReflectionObject)#%d (1) {
+ ["name"]=>
+ string(0) ""
+}
+
+Warning: ReflectionObject::__construct() expects parameter 1 to be object, string given in %s on line 4
+object(ReflectionObject)#%d (1) {
+ ["name"]=>
+ string(0) ""
+}
+
+Warning: ReflectionObject::__construct() expects exactly 1 parameter, 2 given in %s on line 6
+object(ReflectionObject)#%d (1) {
+ ["name"]=>
+ string(0) ""
+}
+
+Warning: ReflectionObject::__construct() expects parameter 1 to be object, integer given in %s on line 7
+object(ReflectionObject)#%d (1) {
+ ["name"]=>
+ string(0) ""
+}
+
+Warning: ReflectionObject::__construct() expects parameter 1 to be object, null given in %s on line 8
+object(ReflectionObject)#%d (1) {
+ ["name"]=>
+ string(0) ""
+}
+
+Warning: ReflectionObject::__construct() expects parameter 1 to be object, array given in %s on line 9
+object(ReflectionObject)#%d (1) {
+ ["name"]=>
+ string(0) ""
+}
diff --git a/ext/reflection/tests/reflectionObject_getConstant_basic.phpt b/ext/reflection/tests/reflectionObject_getConstant_basic.phpt
new file mode 100644
index 0000000000..3d151bc7d5
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_getConstant_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+ReflectionObject::getConstant() basic function test
+--FILE--
+<?php
+class C {
+ const a = 'hello from C';
+}
+class D extends C {
+}
+class E extends D {
+}
+class F extends E {
+ const a = 'hello from F';
+}
+class X {
+}
+
+$classes = array("C", "D", "E", "F", "X");
+foreach($classes as $class) {
+ echo "Reflecting on instance of class $class: \n";
+ $rc = new ReflectionObject(new $class);
+ var_dump($rc->getConstant('a'));
+ var_dump($rc->getConstant('doesntexist'));
+}
+?>
+--EXPECTF--
+Reflecting on instance of class C:
+string(12) "hello from C"
+bool(false)
+Reflecting on instance of class D:
+string(12) "hello from C"
+bool(false)
+Reflecting on instance of class E:
+string(12) "hello from C"
+bool(false)
+Reflecting on instance of class F:
+string(12) "hello from F"
+bool(false)
+Reflecting on instance of class X:
+bool(false)
+bool(false)
diff --git a/ext/reflection/tests/reflectionObject_getConstant_error.phpt b/ext/reflection/tests/reflectionObject_getConstant_error.phpt
new file mode 100644
index 0000000000..3f12f3a1ea
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_getConstant_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+ReflectionObject::getConstant() - invalid params
+--FILE--
+<?php
+class C {
+ const myConst = 1;
+}
+
+$rc = new ReflectionObject(new C);
+var_dump($rc->getConstant());
+var_dump($rc->getConstant("myConst", "myConst"));
+var_dump($rc->getConstant(null));
+var_dump($rc->getConstant(1));
+var_dump($rc->getConstant(1.5));
+var_dump($rc->getConstant(true));
+var_dump($rc->getConstant(array(1,2,3)));
+var_dump($rc->getConstant(new C));
+?>
+--EXPECTF--
+Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 0 given in %s on line 7
+NULL
+
+Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 2 given in %s on line 8
+NULL
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+Warning: ReflectionClass::getConstant() expects parameter 1 to be string, array given in %s on line 13
+NULL
+
+Warning: ReflectionClass::getConstant() expects parameter 1 to be string, object given in %s on line 14
+NULL
diff --git a/ext/reflection/tests/reflectionObject_getConstants_basic.phpt b/ext/reflection/tests/reflectionObject_getConstants_basic.phpt
new file mode 100644
index 0000000000..6479ec90ed
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_getConstants_basic.phpt
@@ -0,0 +1,49 @@
+--TEST--
+ReflectionObject::getConstants() - basic function test
+--FILE--
+<?php
+class C {
+ const a = 'hello from C';
+}
+class D extends C {
+}
+class E extends D {
+}
+class F extends E {
+ const a = 'hello from F';
+}
+class X {
+}
+
+$classes = array("C", "D", "E", "F", "X");
+foreach($classes as $class) {
+ echo "Reflecting on instance of class $class: \n";
+ $rc = new ReflectionObject(new $class);
+ var_dump($rc->getConstants());
+}
+
+?>
+--EXPECTF--
+Reflecting on instance of class C:
+array(1) {
+ ["a"]=>
+ string(12) "hello from C"
+}
+Reflecting on instance of class D:
+array(1) {
+ ["a"]=>
+ string(12) "hello from C"
+}
+Reflecting on instance of class E:
+array(1) {
+ ["a"]=>
+ string(12) "hello from C"
+}
+Reflecting on instance of class F:
+array(1) {
+ ["a"]=>
+ string(12) "hello from F"
+}
+Reflecting on instance of class X:
+array(0) {
+}
diff --git a/ext/reflection/tests/reflectionObject_getConstants_error.phpt b/ext/reflection/tests/reflectionObject_getConstants_error.phpt
new file mode 100644
index 0000000000..81ec9ed2ed
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_getConstants_error.phpt
@@ -0,0 +1,18 @@
+--TEST--
+ReflectionObject::getConstants() - invalid params
+--FILE--
+<?php
+class X {
+}
+
+$rc = new ReflectionObject(new X);
+
+$rc->getConstants('X');
+$rc->getConstants(true);
+
+?>
+--EXPECTF--
+Warning: Wrong parameter count for ReflectionClass::getConstants() in %s on line 7
+
+Warning: Wrong parameter count for ReflectionClass::getConstants() in %s on line 8
+
diff --git a/ext/reflection/tests/reflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/reflectionObject_getConstructor_basic.phpt
new file mode 100644
index 0000000000..a784f6d9e0
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_getConstructor_basic.phpt
@@ -0,0 +1,82 @@
+--TEST--
+ReflectionObject::getConstructor() - basic function test
+--FILE--
+<?php
+class NewCtor {
+ function __construct() {}
+}
+
+class ExtendsNewCtor extends NewCtor {
+}
+
+class OldCtor {
+ function OldCtor() {}
+}
+
+class ExtendsOldCtor extends OldCtor {
+}
+
+
+class X {
+ function Y() {}
+}
+
+class Y extends X {
+}
+
+class OldAndNewCtor {
+ function OldAndNewCtor() {}
+ function __construct() {}
+}
+
+class NewAndOldCtor {
+ function __construct() {}
+ function NewAndOldCtor() {}
+}
+class B {
+ function B() {}
+}
+
+class C extends B {
+ function C() {}
+}
+
+class D1 extends C {
+ function __construct() {}
+}
+
+class D2 extends C {
+}
+
+$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor',
+ 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y');
+
+foreach ($classes as $class) {
+ $rc = new ReflectionObject(new $class);
+ $rm = $rc->getConstructor();
+ if ($rm != null) {
+ echo "Constructor of $class: " . $rm->getName() . "\n";
+ } else {
+ echo "No constructor for $class\n";
+ }
+
+}
+
+?>
+--EXPECTF--
+
+Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line 26
+
+Strict Standards: %s for class NewAndOldCtor in %s on line 31
+Constructor of NewCtor: __construct
+Constructor of ExtendsNewCtor: __construct
+Constructor of OldCtor: OldCtor
+Constructor of ExtendsOldCtor: OldCtor
+Constructor of OldAndNewCtor: __construct
+Constructor of NewAndOldCtor: __construct
+Constructor of B: B
+Constructor of C: C
+Constructor of D1: __construct
+Constructor of D2: C
+No constructor for X
+No constructor for Y
diff --git a/ext/reflection/tests/reflectionObject_getConstructor_error.phpt b/ext/reflection/tests/reflectionObject_getConstructor_error.phpt
new file mode 100644
index 0000000000..5cabc2ed10
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_getConstructor_error.phpt
@@ -0,0 +1,24 @@
+--TEST--
+ReflectionObject::getConstructor() - invalid params
+--FILE--
+<?php
+class C {}
+$rc = new ReflectionObject(new C);
+var_dump($rc->getConstructor(null));
+var_dump($rc->getConstructor('X'));
+var_dump($rc->getConstructor(true));
+var_dump($rc->getConstructor(array(1,2,3)));
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for ReflectionClass::getConstructor() in %s on line 4
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::getConstructor() in %s on line 5
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::getConstructor() in %s on line 6
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::getConstructor() in %s on line 7
+NULL
diff --git a/ext/reflection/tests/reflectionObject_getName_basic.phpt b/ext/reflection/tests/reflectionObject_getName_basic.phpt
new file mode 100644
index 0000000000..db0cbfb08d
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_getName_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+ReflectionObject::getName() - basic function test
+--FILE--
+<?php
+$r0 = new ReflectionObject();
+var_dump($r0->getName());
+
+$r1 = new ReflectionObject(new stdClass);
+var_dump($r1->getName());
+
+class C { }
+$myInstance = new C;
+$r2 = new ReflectionObject($myInstance);
+var_dump($r2->getName());
+
+$r3 = new ReflectionObject($r2);
+var_dump($r3->getName());
+
+?>
+--EXPECTF--
+
+Warning: ReflectionObject::__construct() expects exactly 1 parameter, 0 given in %s on line 2
+string(0) ""
+string(8) "stdClass"
+string(1) "C"
+string(16) "ReflectionObject"
+
diff --git a/ext/reflection/tests/reflectionObject_getName_error.phpt b/ext/reflection/tests/reflectionObject_getName_error.phpt
new file mode 100644
index 0000000000..eb64244c15
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_getName_error.phpt
@@ -0,0 +1,23 @@
+--TEST--
+ReflectionObject::getname() - invalid params
+--FILE--
+<?php
+class C { }
+$myInstance = new C;
+$r2 = new ReflectionObject($myInstance);
+
+$r3 = new ReflectionObject($r2);
+
+var_dump($r3->getName(null));
+var_dump($r3->getName('x','y'));
+var_dump($r3->getName(0));
+?>
+--EXPECTF--
+Warning: Wrong parameter count for ReflectionClass::getName() in %s on line 8
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::getName() in %s on line 9
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::getName() in %s on line 10
+NULL
diff --git a/ext/reflection/tests/reflectionObject_getName_error1.phpt b/ext/reflection/tests/reflectionObject_getName_error1.phpt
new file mode 100644
index 0000000000..26c342d7f4
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_getName_error1.phpt
@@ -0,0 +1,8 @@
+--TEST--
+ReflectionObject::getName - forbid static invocation
+--FILE--
+<?php
+ReflectionObject::getName();
+?>
+--EXPECTF--
+Fatal error: Non-static method ReflectionClass::getName() cannot be called statically in %s on line 2
diff --git a/ext/reflection/tests/reflectionObject_isInstance_basic.phpt b/ext/reflection/tests/reflectionObject_isInstance_basic.phpt
new file mode 100644
index 0000000000..51d42fdf98
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isInstance_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+ReflectionObject::isInstance() - basic function test
+--FILE--
+<?php
+class A {}
+class B extends A {}
+class X {}
+
+$classes = array("A", "B", "X");
+
+$instances = array( "myA" => new A,
+ "myB" => new B,
+ "myX" => new X );
+
+foreach ($classes as $class) {
+ $ro = new ReflectionObject(new $class);
+ foreach ($instances as $name => $instance) {
+ echo "is $name a $class? ";
+ var_dump($ro->isInstance($instance));
+ }
+}
+
+?>
+--EXPECTF--
+is myA a A? bool(true)
+is myB a A? bool(false)
+is myX a A? bool(false)
+is myA a B? bool(false)
+is myB a B? bool(true)
+is myX a B? bool(false)
+is myA a X? bool(false)
+is myB a X? bool(false)
+is myX a X? bool(true)
diff --git a/ext/reflection/tests/reflectionObject_isInstance_error.phpt b/ext/reflection/tests/reflectionObject_isInstance_error.phpt
new file mode 100644
index 0000000000..692c2f8496
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isInstance_error.phpt
@@ -0,0 +1,38 @@
+--TEST--
+ReflectionObject::isInstance() - invalid params
+--FILE--
+<?php
+class X {}
+$instance = new X;
+$ro = new ReflectionObject(new X);
+
+var_dump($ro->isInstance());
+var_dump($ro->isInstance($instance, $instance));
+var_dump($ro->isInstance(1));
+var_dump($ro->isInstance(1.5));
+var_dump($ro->isInstance(true));
+var_dump($ro->isInstance('X'));
+var_dump($ro->isInstance(null));
+
+?>
+--EXPECTF--
+Warning: ReflectionClass::isInstance() expects exactly 1 parameter, 0 given in %s on line 6
+NULL
+
+Warning: ReflectionClass::isInstance() expects exactly 1 parameter, 2 given in %s on line 7
+NULL
+
+Warning: ReflectionClass::isInstance() expects parameter 1 to be object, integer given in %s on line 8
+NULL
+
+Warning: ReflectionClass::isInstance() expects parameter 1 to be object, double given in %s on line 9
+NULL
+
+Warning: ReflectionClass::isInstance() expects parameter 1 to be object, boolean given in %s on line 10
+NULL
+
+Warning: ReflectionClass::isInstance() expects parameter 1 to be object, string given in %s on line 11
+NULL
+
+Warning: ReflectionClass::isInstance() expects parameter 1 to be object, null given in %s on line 12
+NULL
diff --git a/ext/reflection/tests/reflectionObject_isInstantiable_basic.phpt b/ext/reflection/tests/reflectionObject_isInstantiable_basic.phpt
new file mode 100644
index 0000000000..4b8a6ec221
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isInstantiable_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+ReflectionObject::IsInstantiable() - basic function test
+--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", "ifaceImpl", "D");
+
+foreach($classes as $class ) {
+ $ro = new ReflectionObject(new $class);
+ echo "Is $class instantiable? ";
+ var_dump($ro->IsInstantiable());
+}
+?>
+--EXPECTF--
+Is C instantiable? bool(true)
+Is ifaceImpl instantiable? bool(true)
+Is D instantiable? bool(true)
diff --git a/ext/reflection/tests/reflectionObject_isInstantiable_error.phpt b/ext/reflection/tests/reflectionObject_isInstantiable_error.phpt
new file mode 100644
index 0000000000..8f418ac0e6
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isInstantiable_error.phpt
@@ -0,0 +1,22 @@
+--TEST--
+ReflectionObject::IsInstantiable() - invalid params
+--FILE--
+<?php
+class privateCtorOld {
+ private function privateCtorOld() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
+}
+$reflectionObject = privateCtorOld::reflectionObjectFactory();
+
+var_dump($reflectionObject->IsInstantiable('X'));
+var_dump($reflectionObject->IsInstantiable(0, null));
+
+?>
+--EXPECTF--
+Warning: Wrong parameter count for ReflectionClass::isInstantiable() in %s on line 10
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::isInstantiable() in %s on line 11
+NULL
diff --git a/ext/reflection/tests/reflectionObject_isInstantiable_variation.phpt b/ext/reflection/tests/reflectionObject_isInstantiable_variation.phpt
new file mode 100644
index 0000000000..ac7199c096
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isInstantiable_variation.phpt
@@ -0,0 +1,78 @@
+--TEST--
+ReflectionObject::IsInstantiable() - variation - constructors
+--FILE--
+<?php
+
+class noCtor {
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
+}
+
+class publicCtorNew {
+ public function __construct() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
+}
+
+class protectedCtorNew {
+ protected function __construct() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
+}
+
+class privateCtorNew {
+ private function __construct() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
+}
+
+class publicCtorOld {
+ public function publicCtorOld() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
+}
+
+class protectedCtorOld {
+ protected function protectedCtorOld() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
+}
+
+class privateCtorOld {
+ private function privateCtorOld() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
+}
+
+
+$reflectionObjects = array(
+ noCtor::reflectionObjectFactory(),
+ publicCtorNew::reflectionObjectFactory(),
+ protectedCtorNew::reflectionObjectFactory(),
+ privateCtorNew::reflectionObjectFactory(),
+ publicCtorOld::reflectionObjectFactory(),
+ protectedCtorOld::reflectionObjectFactory(),
+ privateCtorOld::reflectionObjectFactory()
+ );
+
+foreach($reflectionObjects as $reflectionObject ) {
+ $name = $reflectionObject->getName();
+ echo "Is $name instantiable? ";
+ var_dump($reflectionObject->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)
diff --git a/ext/reflection/tests/reflectionObject_isInternal_basic.phpt b/ext/reflection/tests/reflectionObject_isInternal_basic.phpt
new file mode 100644
index 0000000000..066bca70ee
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isInternal_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+ReflectionObject::isInternal() - basic function test
+--FILE--
+<?php
+class C {
+}
+
+$r1 = new ReflectionObject(new stdClass);
+$r2 = new ReflectionObject(new ReflectionClass('C'));
+$r3 = new ReflectionObject(new ReflectionProperty('Exception', 'message'));
+$r4 = new ReflectionObject(new Exception);
+$r5 = new ReflectionObject(new C);
+
+var_dump($r1->isInternal(), $r2->isInternal(), $r3->isInternal(),
+ $r4->isInternal(), $r5->isInternal());
+
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
diff --git a/ext/reflection/tests/reflectionObject_isInternal_error.phpt b/ext/reflection/tests/reflectionObject_isInternal_error.phpt
new file mode 100644
index 0000000000..c22d748072
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isInternal_error.phpt
@@ -0,0 +1,15 @@
+--TEST--
+ReflectionObject::isInternal() - invalid params
+--FILE--
+<?php
+
+$r1 = new ReflectionObject(new stdClass);
+var_dump($r1->isInternal('X'));
+var_dump($r1->isInternal('X', true));
+?>
+--EXPECTF--
+Warning: Wrong parameter count for ReflectionClass::isInternal() in %s on line 4
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::isInternal() in %s on line 5
+NULL
diff --git a/ext/reflection/tests/reflectionObject_isSubclassOf_basic.phpt b/ext/reflection/tests/reflectionObject_isSubclassOf_basic.phpt
new file mode 100644
index 0000000000..e89066a7ea
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isSubclassOf_basic.phpt
@@ -0,0 +1,116 @@
+--TEST--
+ReflectionObject::isSubclassOf() - basic function test
+--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');
+
+//Create ReflectionClasses
+foreach ($classNames as $className) {
+ $rcs[$className] = new ReflectionClass($className);
+}
+
+//Create ReflectionObjects
+foreach ($classNames as $className) {
+ if ($rcs[$className]->isInstantiable()) {
+ $ros[$className] = new ReflectionObject(new $className);
+ }
+}
+
+foreach ($ros as $childName => $child) {
+ foreach ($rcs as $parentName => $parent) {
+ echo "Is " . $childName . " a subclass of " . $parentName . "? \n";
+ echo " - Using ReflectionClass object argument: ";
+ var_dump($child->isSubclassOf($parent));
+ if ($parent->isInstantiable()) {
+ echo " - Using ReflectionObject object argument: ";
+ var_dump($child->isSubclassOf($ros[$parentName]));
+ }
+ echo " - Using string argument: ";
+ var_dump($child->isSubclassOf($parentName));
+ }
+}
+?>
+--EXPECTF--
+Is A a subclass of A?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is A a subclass of B?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is A a subclass of C?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is A a subclass of I?
+ - Using ReflectionClass object argument: bool(false)
+ - Using string argument: bool(false)
+Is A a subclass of X?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is B a subclass of A?
+ - Using ReflectionClass object argument: bool(true)
+ - Using ReflectionObject object argument: bool(true)
+ - Using string argument: bool(true)
+Is B a subclass of B?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is B a subclass of C?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is B a subclass of I?
+ - Using ReflectionClass object argument: bool(false)
+ - Using string argument: bool(false)
+Is B a subclass of X?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is C a subclass of A?
+ - Using ReflectionClass object argument: bool(true)
+ - Using ReflectionObject object argument: bool(true)
+ - Using string argument: bool(true)
+Is C a subclass of B?
+ - Using ReflectionClass object argument: bool(true)
+ - Using ReflectionObject object argument: bool(true)
+ - Using string argument: bool(true)
+Is C a subclass of C?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is C a subclass of I?
+ - Using ReflectionClass object argument: bool(false)
+ - Using string argument: bool(false)
+Is C a subclass of X?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is X a subclass of A?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is X a subclass of B?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is X a subclass of C?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
+Is X a subclass of I?
+ - Using ReflectionClass object argument: bool(true)
+ - Using string argument: bool(true)
+Is X a subclass of X?
+ - Using ReflectionClass object argument: bool(false)
+ - Using ReflectionObject object argument: bool(false)
+ - Using string argument: bool(false)
diff --git a/ext/reflection/tests/reflectionObject_isSubclassOf_error.phpt b/ext/reflection/tests/reflectionObject_isSubclassOf_error.phpt
new file mode 100644
index 0000000000..9387b7dcb3
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isSubclassOf_error.phpt
@@ -0,0 +1,24 @@
+--TEST--
+ReflectionObject::isSubclassOf() - invalid params
+--FILE--
+<?php
+class A {}
+$ro = new ReflectionObject(new A);
+
+var_dump($ro->isSubclassOf());
+var_dump($ro->isSubclassOf('A',5));
+var_dump($ro->isSubclassOf('X'));
+
+?>
+--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
+
+Fatal error: Uncaught exception 'ReflectionException' with message 'Class X does not exist' in %s:7
+Stack trace:
+#0 %s(7): ReflectionClass->isSubclassOf('X')
+#1 {main}
+ thrown in %s on line 7
diff --git a/ext/reflection/tests/reflectionObject_isUserDefined_basic.phpt b/ext/reflection/tests/reflectionObject_isUserDefined_basic.phpt
new file mode 100644
index 0000000000..4cb08fcb67
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isUserDefined_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+ReflectionObject::isUserDefined() - basic function test
+--FILE--
+<?php
+class C {
+}
+
+$r1 = new ReflectionObject(new stdClass);
+$r2 = new ReflectionObject(new ReflectionClass('C'));
+$r3 = new ReflectionObject(new ReflectionProperty('Exception', 'message'));
+$r4 = new ReflectionObject(new Exception);
+$r5 = new ReflectionObject(new C);
+
+var_dump($r1->isUserDefined(), $r2->isUserDefined(), $r3->isUserDefined(),
+ $r4->isUserDefined(), $r5->isUserDefined());
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
diff --git a/ext/reflection/tests/reflectionObject_isUserDefined_error.phpt b/ext/reflection/tests/reflectionObject_isUserDefined_error.phpt
new file mode 100644
index 0000000000..70533cf3d6
--- /dev/null
+++ b/ext/reflection/tests/reflectionObject_isUserDefined_error.phpt
@@ -0,0 +1,15 @@
+--TEST--
+ReflectionObject::isUserDefined() - invalid params
+--FILE--
+<?php
+$r1 = new ReflectionObject(new stdClass);
+
+var_dump($r1->isUserDefined('X'));
+var_dump($r1->isUserDefined('X', true));
+?>
+--EXPECTF--
+Warning: Wrong parameter count for ReflectionClass::isUserDefined() in %s on line 4
+NULL
+
+Warning: Wrong parameter count for ReflectionClass::isUserDefined() in %s on line 5
+NULL