PHPUnit_Framework_Assert::assertNotInstanceOf PHP Method

assertNotInstanceOf() public static method

Asserts that a variable is not of a given type.
public static assertNotInstanceOf ( string $expected, mixed $actual, string $message = '' )
$expected string
$actual mixed
$message string
    public static function assertNotInstanceOf($expected, $actual, $message = '')
    {
        if (!(is_string($expected) && (class_exists($expected) || interface_exists($expected)))) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'class or interface name');
        }
        $constraint = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_IsInstanceOf($expected));
        static::assertThat($actual, $constraint, $message);
    }

Usage Example

Example #1
0
/**
 * Asserts that a variable is not of a given type.
 *
 * @param string $expected
 * @param mixed  $actual
 * @param string $message
 * @since Method available since Release 3.5.0
 */
function assertNotInstanceOf($expected, $actual, $message = '')
{
    return PHPUnit_Framework_Assert::assertNotInstanceOf($expected, $actual, $message);
}
All Usage Examples Of PHPUnit_Framework_Assert::assertNotInstanceOf
PHPUnit_Framework_Assert