summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2004-03-01 20:40:51 +0000
committerPierre Joye <pajoye@php.net>2004-03-01 20:40:51 +0000
commit6f68407894ac41f17e99cc1baf12d794c9d03d4a (patch)
tree3c9f18bad72ba7704723376a9488815a00ff3aa9
parent03bdd135600eb017bfe93b9cb19a4306e53d6b0c (diff)
downloadphp-git-6f68407894ac41f17e99cc1baf12d794c9d03d4a.tar.gz
- initial release, reflection tests suite
-rw-r--r--ext/reflection/tests/exception.php16
-rwxr-xr-xext/reflection/tests/invoke.phpt44
2 files changed, 60 insertions, 0 deletions
diff --git a/ext/reflection/tests/exception.php b/ext/reflection/tests/exception.php
new file mode 100644
index 0000000000..8570b6b360
--- /dev/null
+++ b/ext/reflection/tests/exception.php
@@ -0,0 +1,16 @@
+<?php
+class reflectionException extends reflection_exception {
+ function MyException($_errno, $_errmsg) {
+ $this->errno = $_errno;
+ $this->errmsg = $_errmsg;
+ }
+
+ function getErrno() {
+ return $this->errno;
+ }
+
+ function getErrmsg() {
+ return $this->errmsg;
+ }
+}
+?>
diff --git a/ext/reflection/tests/invoke.phpt b/ext/reflection/tests/invoke.phpt
new file mode 100755
index 0000000000..079ab43c2e
--- /dev/null
+++ b/ext/reflection/tests/invoke.phpt
@@ -0,0 +1,44 @@
+--TEST--
+invoke with non object or null value
+--FILE--
+<?php
+
+include_once dirname(__FILE__).'/exception.php';
+
+class a {
+ function a(){
+ }
+}
+class b {
+}
+
+$b = new b();
+
+$a=new Reflection_Class("a");
+$m=$a->getMethod("a");
+
+try {
+ $m->invoke(null);
+} catch (reflection_exception $E) {
+ echo $E->getMessage()."\n";
+}
+
+
+try {
+ $m->invoke($b);
+} catch (reflection_exception $E) {
+ echo $E->getMessage()."\n";
+}
+
+$b = new a();
+try {
+ $m->invoke($b);
+} catch (reflection_exception $E) {
+ echo $E->getMessage()."\n";
+}
+
+echo "===DONE===\n";?>
+--EXPECT--
+Non-object passed to Invoke()
+Given object is not an instance of the class this method was declared in
+===DONE===