You are here

public static function PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Assert.php \PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile()

Asserts that the generated JSON encoded object and the content of the given file are equal.

Parameters

string $expectedFile:

string $actualJson:

string $message:

3 calls to PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile()
Framework_AssertTest::testAssertJsonStringEqualsJsonFile in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile
Framework_AssertTest::testAssertJsonStringEqualsJsonFileExpectingException in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile
Framework_AssertTest::testAssertJsonStringEqualsJsonFileExpectingExpectationFailedException in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile

File

vendor/phpunit/phpunit/src/Framework/Assert.php, line 2245

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = '') {
  self::assertFileExists($expectedFile, $message);
  $expectedJson = file_get_contents($expectedFile);
  self::assertJson($expectedJson, $message);
  self::assertJson($actualJson, $message);

  // call constraint
  $constraint = new PHPUnit_Framework_Constraint_JsonMatches($expectedJson);
  self::assertThat($actualJson, $constraint, $message);
}