assertXmlStringEqualsXmlString()
assertXmlStringEqualsXmlString(string $expectedXml, string $actualXml[, string $message = ''])
Reports an error identified by $message
if the XML document in $actualXml
is not equal to the XML document in $expectedXml
.
assertXmlStringNotEqualsXmlString()
is the inverse of this assertion and takes the same arguments.
Example A.53: Usage of assertXmlStringEqualsXmlString()
<?php use PHPUnit\Framework\TestCase; class XmlStringEqualsXmlStringTest extends TestCase { public function testFailure() { $this->assertXmlStringEqualsXmlString( '<foo><bar/></foo>', '<foo><baz/></foo>'); } } ?>
phpunit XmlStringEqualsXmlStringTest PHPUnit 5.6.0 by Sebastian Bergmann and contributors. F Time: 0 seconds, Memory: 5.00Mb There was 1 failure: 1) XmlStringEqualsXmlStringTest::testFailure Failed asserting that two DOM documents are equal. --- Expected +++ Actual @@ @@ <?xml version="1.0"?> <foo> - <bar/> + <baz/> </foo> /home/sb/XmlStringEqualsXmlStringTest.php:7 FAILURES! Tests: 1, Assertions: 1, Failures: 1.
Please login to continue.