lithium\test\Unit::assertInstanceOf()

public method

Assert that $actual is an instance of $expected.

$this->assertInstanceOf('stdClass', new stdClass); // succeeds
$this->assertInstanceOf('ReflectionClass', new stdClass); // fails

Parameters

  • string $expected

    Fully namespaced expected class.

  • object $actual

    Object you are testing.

  • string|boolean $message

Returns

boolean

true if the assertion succeeded, false otherwise.

Source

	public function assertInstanceOf($expected, $actual, $message = '{:message}') {
		return $this->assert(is_a($actual, $expected), $message, [
			'expected' => $expected,
			'result' => get_class($actual)
		]);
	}