Asserts that a variable is null.
public static assertNull ( mixed $actual, string $message = '' ) | ||
$actual | mixed | |
$message | string |
public function testNullValue() { $value = null; $this->assertNull($value); }
class MyClassTest extends PHPUnit_Framework_TestCase { public function testNullObject() { $myclass = new MyClass(); $this->assertNull($myclass->property); } } class MyClass { public $property; }Here, we are testing that the `property` property of the `MyClass` object is null. The `assertNull` method will pass this test if `$myclass->property` is indeed null. The PHPUnit_Framework_Assert class is part of the PHPUnit testing framework, which is a library of tools for unit testing in PHP.
public static assertNull ( mixed $actual, string $message = '' ) | ||
$actual | mixed | |
$message | string |