You are here

public static function PHPUnit_Framework_Assert::assertInstanceOf in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Assert.php \PHPUnit_Framework_Assert::assertInstanceOf()

Asserts that a variable is of a given type.

@since Method available since Release 3.5.0

Parameters

string $expected:

mixed $actual:

string $message:

15 calls to PHPUnit_Framework_Assert::assertInstanceOf()
Framework_AssertTest::testAssertInstanceOf in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertInstanceOf
Framework_AssertTest::testAssertInstanceOfThrowsExceptionForInvalidArgument in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertInstanceOf @expectedException PHPUnit_Framework_Exception
Framework_MockObjectTest::testGetMockForTraversable in vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php
@dataProvider traversableProvider
Framework_MockObjectTest::testGetMockWithFixedClassNameCanProduceTheSameMockTwice in vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php
@covers PHPUnit_Framework_MockObject_Generator::getMock
Framework_MockObjectTest::testInterfaceWithStaticMethodCanBeStubbed in vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php
@ticket 156

... See full list

File

vendor/phpunit/phpunit/src/Framework/Assert.php, line 1244

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertInstanceOf($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_IsInstanceOf($expected);
  self::assertThat($actual, $constraint, $message);
}