PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Testing » PHPUnit » Bug #4007

assertIsA

Details

Request #4007assertIsA
Submitted2005-03-30 19:52 UTC
Frombmihelac at mihelac dot org
StatusClosed
PackagePHPUnit
PHP VersionIrrelevant
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);
}
}