Asserts that a condition is true.
public static assertTrue ( boolean $condition, string $message = '' ) | ||
$condition | boolean | |
$message | string |
use PHPUnit\Framework\TestCase; class MyTestClass extends TestCase { public function testSomething() { $value = 42; $this->assertTrue(is_int($value)); } }In this example, the `assertTrue()` method is used to check if `$value` is an integer. If it is, the test passes. If not, the test fails. The PHPUnit_Framework_Assert belongs to the PHPUnit package/library.
public static assertTrue ( boolean $condition, string $message = '' ) | ||
$condition | boolean | |
$message | string |