PHPUnit assertStringNotEqualsFile() Function Last Updated : 07 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. In case of true the asserted test case got passed else test case got failed. Syntax: assertStringNotEqualsFile(string $expectedFile, string $actualString[, string $message = '']) Parameters: This function accepts three parameters as mentioned above and described below: $expectedfile: This parameter is of any type which represents the expected file.$actualstring: This parameter is of any type which represents the actual string content.$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 assertStringNotEqualsFile() function in PHPUnit: Example 1: PHP <?php use PHPUnit\Framework\TestCase; class GeeksPhpunitTestCase extends TestCase { public function testNegativeTestcaseForassertStringNotEqualsFile() { $expectedfile = "/home/lovely/Documents/php/abc"; $actualstring = "File has not geeksforgeeks"; // Assert function to test whether expected file // content is equal to actual string content $this->assertStringNotEqualsFile( $expectedfile, $actualstring, "actual string content is equals to expected file content" ); } } ?> Output: PHPUnit 8.5.8 by Sebastian Bergmann and contributors. F 1 / 1 (100%) Time: 86 ms, Memory: 10.00 MB There was 1 failure: 1) GeeksPhpunitTestCase::testPositiveTestcaseForassertStringNotEqualsFile actual string content is equals to expected file content Failed asserting that 'File does not have not geeksforgeeks' is not equal to 'File does not have not geeksforgeeks'. /home/lovely/Documents/php/test.php:17 FAILURES! Tests: 1, Assertions: 2, Failures: 1. Example 2: PHP <?php use PHPUnit\Framework\TestCase; class GeeksPhpunitTestCase extends TestCase { public function testPositiveTestcaseForassertStringNotEqualsFile() { $expectedfile = "/home/lovely/Documents/php/abc"; $actualstring = "File has geeksforgeeks"; // Assert function to test whether expected file // content is equal to actual string content $this->assertStringNotEqualsFile( $expectedfile, $actualstring, "actual string content is equals to expected file content" ); } } Output: PHPUnit 8.5.8 by Sebastian Bergmann and contributors. . 1 / 1 (100%) Time: 88 ms, Memory: 10.00 MB OK (1 test, 2 assertions) Comment More infoAdvertise with us Next Article PHPUnit assertXmlStringNotEqualsXmlFile() Function S shubham_singh Follow Improve Article Tags : Web Technologies PHP PHP-PHPUnit Similar Reads 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 assertXmlStringNotEqualsXmlFile() Function 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 r 2 min read 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 | assertNotEquals() Function The assertNotEquals() function is a builtin function in PHPUnit and is used to assert the actual obtained value to be not-equals to expected value. This assertion will return true in the case if the expected value is not-equals to actual value else returns false. In case of true the asserted test ca 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 assertFileNotEquals() Function The assertFileNotEquals() function is a builtin function in PHPUnit and is used to assert whether the actual file content is different from expected file content or not. This assertion will return true in the case if the expected file content is not-equals to actual file content else returns false. 2 min read Like