PHPUnit assertXmlStringNotEqualsXmlFile() Function Last Updated : 13 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The assertXmlStringNotEqualsXmlFile() function is a builtin function in PHPUnit and is used to assert whether the actual XML file Content is not equals to expected XML string. This assertion will return true in the case if the expected XML string is not the same as the actual XML file content else returns false. In case of true the asserted test case got passed else test case got failed. Syntax: assertXmlStringNotEqualsXmlFile(string $expectedFile, string $actualFile[, string $message = '']) Parameters: This function accepts three parameters as mentioned above and described below: $expectedXmlString: This parameter is of any type which represents the expected XML string. $actualXmlFile: This parameter is of any type which represents the actual XML File Path. $message: This parameter takes a string value. When the test case got failed this string message got displayed as an error message. Below examples illustrate the assertXmlstringNotEqualsXmlFile() function in PHPUnit: Example 1: PHP <?php use PHPUnit\Framework\TestCase; class GeeksPhpunitTestCase extends TestCase { public function testNegativeTestcaseForassertXmlStringNotEqualsXmlFile() { $expectedxmlString = '<foo><baz></baz></foo>'; $actualxmlFilePath = '/home/lovely/Documents/php/actual.xml'; // Assert function to test whether given // expected xml string is not equal to actual xml file path $this->assertXmlStringNotEqualsXmlFile( $actualxmlFilePath, $expectedxmlString, "actual xml file path is not equal to expected xml string" ); } } ?> Output: PHPUnit 8.5.8 by Sebastian Bergmann and contributors. F 1 / 1 (100%) Time: 88 ms, Memory: 10.00 MB There was 1 failure: 1) GeeksPhpunitTestCase::testPositiveTestcaseForassertXmlFileNotEqualsXmlFile actual xml file path is equal to expected xml string Failed asserting that DOMDocument Object &00000000619c324c000000000e19116f () is not equal to DOMDocument Object &00000000619c324b000000000e19116f (). /home/lovely/Documents/php/test.php:16 FAILURES! Tests: 1, Assertions: 1, Failures: 1. Example 2: PHP <?php use PHPUnit\Framework\TestCase; class GeeksPhpunitTestCase extends TestCase { public function testPositiveTestcaseForassertXmlStringNotEqualsXmlFile() { $expectedxmlString = '<foo><baza></baza></foo>'; $actualxmlFilePath = '/home/lovely/Documents/php/actual.xml'; // Assert function to test whether given // expected xml string is not equal to actual xml file path $this->assertXmlStringNotEqualsXmlFile( $actualxmlFilePath, $expectedxmlString, "actual xml file path is not equal to expected xml string" ); } } ?> Output: PHPUnit 8.5.8 by Sebastian Bergmann and contributors. . 1 / 1 (100%) Time: 87 ms, Memory: 10.00 MB OK (1 test, 1 assertion) Comment More infoAdvertise with us Next Article PHPUnit assertXmlFileNotEqualsXmlFile() Function S shubham_singh Follow Improve Article Tags : Web Technologies PHP PHP-PHPUnit Similar Reads PHPUnit assertXmlStringEqualsXmlFile() Function The assertXmlStringEqualsXmlFile() function is a builtin function in PHPUnit and is used to assert whether the actual XML file Content is equals to expected XML string or not. This assertion will return true in the case if the expected XML string is the same as the actual XML file content else retur 2 min read PHPUnit assertStringNotEqualsFile() Function The assertStringNotEqualsFile() function is a builtin function in PHPUnit and is used to assert whether the actual string content Doesn't equal to expected file. This assertion will return true in the case if the expected file content is the not same as the actual string content else returns false. 2 min read PHPUnit assertXmlStringNotEqualsXmlString() Function The assertXmlStringNotEqualsXmlString() function is a builtin function in PHPUnit and is used to assert whether the actual XML string is not equals to expected XML string. This assertion will return true in the case if the expected XML string is not the same as the actual XML string else returns fal 2 min read PHPUnit assertXmlFileNotEqualsXmlFile() Function The assertXmlFileNotEqualsXmlFile() function is a builtin function in PHPUnit and is used to assert whether the actual XML file Content is not equals to expected XML file content. This assertion will return true in the case if the expected XML file content is not the same as the actual XML file cont 2 min read PHPUnit assertStringEqualsFile() Function The assertStringEqualsFile() function is a builtin function in PHPUnit and is used to assert whether the actual string content obtained is equaled to the expected file or not. This assertion will return true in the case if the expected file content is the same as the actual string content else retur 2 min read PHPUnit assertXmlFileEqualsXmlFile() Function The assertXmlFileEqualsXmlFile() function is a builtin function in PHPUnit and is used to assert whether the actual XML file Content is equals to expected XML file content or not. This assertion will return true in the case if the expected XML file content is the same as the actual XML file content 2 min read Like