Asserts that a variable is not empty.
public static assertNotEmpty ( mixed $actual, string $message = '' ) | ||
$actual | mixed | |
$message | string |
$array = ['hello', 'world']; PHPUnit_Framework_Assert::assertNotEmpty($array);
$string = ''; PHPUnit_Framework_Assert::assertNotEmpty($string);
$user = null; PHPUnit_Framework_Assert::assertNotEmpty($user);In this example, we have a variable $user that is null. We use assertNotEmpty to check if the variable is not empty. Since the variable is empty, this assertion will fail. The assertNotEmpty method is part of the PHPUnit testing framework, which is a library for PHP.
public static assertNotEmpty ( mixed $actual, string $message = '' ) | ||
$actual | mixed | |
$message | string |