public static function 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 drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile
Framework_AssertTest::testAssertJsonStringEqualsJsonFileExpectingException in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile
Framework_AssertTest::testAssertJsonStringEqualsJsonFileExpectingExpectationFailedException in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php, line 2196

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);
}