assertInternalType()
assertInternalType($expected, $actual[, $message = ''])
Reports an error identified by $message if $actual is not of the $expected type.
assertNotInternalType() is the inverse of this assertion and takes the same arguments.
assertAttributeInternalType() and assertAttributeNotInternalType() are convenience wrappers that can be applied to a public, protected, or private attribute of a class or object.
Example A.30: Usage of assertInternalType()
<?php
use PHPUnit\Framework\TestCase;
class InternalTypeTest extends TestCase
{
public function testFailure()
{
$this->assertInternalType('string', 42);
}
}
?>
phpunit InternalTypeTest PHPUnit 5.6.0 by Sebastian Bergmann and contributors. F Time: 0 seconds, Memory: 5.00Mb There was 1 failure: 1) InternalTypeTest::testFailure Failed asserting that 42 is of type "string". /home/sb/InternalTypeTest.php:6 FAILURES! Tests: 1, Assertions: 1, Failures: 1.
Please login to continue.