Home » Testing » PHPUnit » Bug #4007
assertIsA
Details
| Request #4007 | assertIsA |
|---|---|
| Submitted | 2005-03-30 19:52 UTC |
| From | bmihelac at mihelac dot org |
| Status | Closed |
| Package | PHPUnit |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2005-03-30 19:52 UTC] bmihelac at mihelac dot org
Description:
------------
2 very simple methods below adds a functionality to test if result is of specificed class. I think this methods would be of use.
Reproduce code:
---------------
function assertIsA($expected, $object, $message = '') {
$message = "expected $expected actual " . get_class($object);
if (!is_a($object, $expected)) {
return $this->fail($message);
}
}
function assertIsNotA($expected, $object, $message = '') {
$message = "expected not $expected actual " . get_class($object);
if (is_a($object, $expected)) {
return $this->fail($message);
}
}