public function Framework_AssertTest::testAssertJsonStringEqualsJsonFileExpectingExpectationFailedException

@covers PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile

File

drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php, line 4159

Class

Framework_AssertTest
@package PHPUnit @author Sebastian Bergmann <sebastian@phpunit.de> @author Bernhard Schussek <bschussek@2bepublished.at> @copyright 2001-2013 Sebastian Bergmann <sebastian@phpunit.de> @license …

Code

public function testAssertJsonStringEqualsJsonFileExpectingExpectationFailedException() {
  $file = __DIR__ . '/../_files/JsonData/simpleObject.js';
  $actual = json_encode(array(
    "Mascott" => "Beastie",
  ));
  $message = '';
  try {
    $this
      ->assertJsonStringEqualsJsonFile($file, $actual, $message);
  } catch (PHPUnit_Framework_ExpectationFailedException $e) {
    $this
      ->assertEquals('Failed asserting that \'{"Mascott":"Beastie"}\' matches JSON string "{"Mascott":"Tux"}".', $e
      ->getMessage());
    return;
  }
  $this
    ->fail('Expected Exception not thrown.');
}