assertTrue()

assertTrue() assertTrue(bool $condition[, string $message = '']) Reports an error identified by $message if $condition is false. assertNotTrue() is the inverse of this assertion and takes the same arguments. Example A.50: Usage of assertTrue() <?php use PHPUnit\Framework\TestCase; class TrueTest extends TestCase { public function testFailure() { $this->assertTrue(false); } } ?> phpunit TrueTest PHPUnit 5.6.0 by Sebastian Bergmann and contributors. F Time: 0 sec

assertXmlStringEqualsXmlFile()

assertXmlStringEqualsXmlFile() assertXmlStringEqualsXmlFile(string $expectedFile, string $actualXml[, string $message = '']) Reports an error identified by $message if the XML document in $actualXml is not equal to the XML document in $expectedFile. assertXmlStringNotEqualsXmlFile() is the inverse of this assertion and takes the same arguments. Example A.52: Usage of assertXmlStringEqualsXmlFile() <?php use PHPUnit\Framework\TestCase; class XmlStringEqualsXmlFileTest extends TestCase {

assertStringEndsWith()

assertStringEndsWith() assertStringEndsWith(string $suffix, string $string[, string $message = '']) Reports an error identified by $message if the $string does not end with $suffix. assertStringEndsNotWith() is the inverse of this assertion and takes the same arguments. Example A.46: Usage of assertStringEndsWith() <?php use PHPUnit\Framework\TestCase; class StringEndsWithTest extends TestCase { public function testFailure() { $this->assertStringEndsWith('suffix', 'foo'

assertStringEqualsFile()

assertStringEqualsFile() assertStringEqualsFile(string $expectedFile, string $actualString[, string $message = '']) Reports an error identified by $message if the file specified by $expectedFile does not have $actualString as its contents. assertStringNotEqualsFile() is the inverse of this assertion and takes the same arguments. Example A.47: Usage of assertStringEqualsFile() <?php use PHPUnit\Framework\TestCase; class StringEqualsFileTest extends TestCase { public function testFailur

assertStringMatchesFormat()

assertStringMatchesFormat() assertStringMatchesFormat(string $format, string $string[, string $message = '']) Reports an error identified by $message if the $string does not match the $format string. assertStringNotMatchesFormat() is the inverse of this assertion and takes the same arguments. Example A.42: Usage of assertStringMatchesFormat() <?php use PHPUnit\Framework\TestCase; class StringMatchesFormatTest extends TestCase { public function testFailure() { $this->ass

assertRegExp()

assertRegExp() assertRegExp(string $pattern, string $string[, string $message = '']) Reports an error identified by $message if $string does not match the regular expression $pattern. assertNotRegExp() is the inverse of this assertion and takes the same arguments. Example A.41: Usage of assertRegExp() <?php use PHPUnit\Framework\TestCase; class RegExpTest extends TestCase { public function testFailure() { $this->assertRegExp('/foo/', 'bar'); } } ?> phpunit RegExp

assertSame()

assertSame() assertSame(mixed $expected, mixed $actual[, string $message = '']) Reports an error identified by $message if the two variables $expected and $actual do not have the same type and value. assertNotSame() is the inverse of this assertion and takes the same arguments. assertAttributeSame() and assertAttributeNotSame() are convenience wrappers that use a public, protected, or private attribute of a class or object as the actual value. Example A.44: Usage of assertSame() <?php use

assertLessThanOrEqual()

assertLessThanOrEqual() assertLessThanOrEqual(mixed $expected, mixed $actual[, string $message = '']) Reports an error identified by $message if the value of $actual is not less than or equal to the value of $expected. assertAttributeLessThanOrEqual() is a convenience wrapper that uses a public, protected, or private attribute of a class or object as the actual value. Example A.37: Usage of assertLessThanOrEqual() <?php use PHPUnit\Framework\TestCase; class LessThanOrEqualTest extends Tes

assertLessThan()

assertLessThan() assertLessThan(mixed $expected, mixed $actual[, string $message = '']) Reports an error identified by $message if the value of $actual is not less than the value of $expected. assertAttributeLessThan() is a convenience wrapper that uses a public, protected, or private attribute of a class or object as the actual value. Example A.36: Usage of assertLessThan() <?php use PHPUnit\Framework\TestCase; class LessThanTest extends TestCase { public function testFailure() {

assertNull()

assertNull() assertNull(mixed $variable[, string $message = '']) Reports an error identified by $message if $variable is not null. assertNotNull() is the inverse of this assertion and takes the same arguments. Example A.39: Usage of assertNull() <?php use PHPUnit\Framework\TestCase; class NullTest extends TestCase { public function testFailure() { $this->assertNull('foo'); } } ?> phpunit NotNullTest PHPUnit 5.6.0 by Sebastian Bergmann and contributors. F Time: