public static function PHPUnit_Framework_Assert::assertJsonFileEqualsJsonFile in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Framework/Assert.php \PHPUnit_Framework_Assert::assertJsonFileEqualsJsonFile()
Asserts that two JSON files are equal.
Parameters
string $expectedFile:
string $actualFile:
string $message:
1 call to PHPUnit_Framework_Assert::assertJsonFileEqualsJsonFile()
- Framework_AssertTest::testAssertJsonFileEqualsJsonFile in vendor/
phpunit/ phpunit/ tests/ Framework/ AssertTest.php - @covers PHPUnit_Framework_Assert::assertJsonFileEqualsJsonFile
File
- vendor/
phpunit/ phpunit/ src/ Framework/ Assert.php, line 2320
Class
- PHPUnit_Framework_Assert
- A set of assert methods.
Code
public static function assertJsonFileEqualsJsonFile($expectedFile, $actualFile, $message = '') {
self::assertFileExists($expectedFile, $message);
self::assertFileExists($actualFile, $message);
$actualJson = file_get_contents($actualFile);
$expectedJson = file_get_contents($expectedFile);
self::assertJson($expectedJson, $message);
self::assertJson($actualJson, $message);
// call constraint
$constraintExpected = new PHPUnit_Framework_Constraint_JsonMatches($expectedJson);
$constraintActual = new PHPUnit_Framework_Constraint_JsonMatches($actualJson);
self::assertThat($expectedJson, $constraintActual, $message);
self::assertThat($actualJson, $constraintExpected, $message);
}