PHP: detect if a non-object is passed to check::classname() in the testsuite
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11505 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
76a90e6606
commit
5161a12868
1 changed files with 2 additions and 0 deletions
|
|
@ -70,6 +70,8 @@ class check {
|
||||||
}
|
}
|
||||||
|
|
||||||
function classname($string,$object) {
|
function classname($string,$object) {
|
||||||
|
if (!is_object($object))
|
||||||
|
return check::fail("The second argument is a " . gettype($object) . ", not an object.");
|
||||||
if (strtolower($string)!=strtolower($classname=get_class($object))) return check::fail("Object: \$object is of class %s not class %s",$classname,$string);
|
if (strtolower($string)!=strtolower($classname=get_class($object))) return check::fail("Object: \$object is of class %s not class %s",$classname,$string);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue