assertXmlStringEqualsXmlString()

最后更新于:2022-04-01 03:48:27

# assertXmlStringEqualsXmlString() >[info] ## assertXmlStringEqualsXmlString(string $expectedXml, string $actualXml[, string $message = '']) 当 `$actualXml` 对应的 XML 文档与 `$expectedXml` 对应的 XML 文档不相同时报告错误,错误讯息由 `$message` 指定。 `assertXmlStringNotEqualsXmlString()` 是与之相反的断言,接受相同的参数。 **Example A.46. assertXmlStringEqualsXmlString() 的用法** ~~~ <?php class XmlStringEqualsXmlStringTest extends PHPUnit_Framework_TestCase { public function testFailure() { $this->assertXmlStringEqualsXmlString( '<foo><bar/></foo>', '<foo><baz/></foo>'); } } ?> ~~~ ~~~ phpunit XmlStringEqualsXmlStringTest PHPUnit 5.0.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. ~~~
';