assertXmlFileEqualsXmlFile()

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

assertStringMatchesFormatFile()

assertStringMatchesFormatFile() assertStringMatchesFormatFile(string $formatFile, string $string[, string $message = '']) Reports an error identified by $message if the $string does not match the contents of the $formatFile. assertStringNotMatchesFormatFile() is the inverse of this assertion and takes the same arguments. Example A.43: Usage of assertStringMatchesFormatFile() <?php use PHPUnit\Framework\TestCase; class StringMatchesFormatFileTest extends TestCase { public function test

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

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'

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

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

assertObjectHasAttribute()

assertObjectHasAttribute() assertObjectHasAttribute(string $attributeName, object $object[, string $message = '']) Reports an error identified by $message if $object->attributeName does not exist. assertObjectNotHasAttribute() is the inverse of this assertion and takes the same arguments. Example A.40: Usage of assertObjectHasAttribute() <?php use PHPUnit\Framework\TestCase; class ObjectHasAttributeTest extends TestCase { public function testFailure() { $this->assert

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() {

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