public static function PHPUnit_Framework_Assert::assertJson

Asserts that a string is a valid JSON string.

@since Method available since Release 3.7.20

Parameters

string $filename:

string $message:

6 calls to PHPUnit_Framework_Assert::assertJson()
PHPUnit_Framework_Assert::assertJsonFileEqualsJsonFile in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php
Asserts that two JSON files are equal.
PHPUnit_Framework_Assert::assertJsonFileNotEqualsJsonFile in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php
Asserts that two JSON files are not equal.
PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php
Asserts that the generated JSON encoded object and the content of the given file are equal.
PHPUnit_Framework_Assert::assertJsonStringEqualsJsonString in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php
Asserts that two given JSON encoded objects or arrays are equal.
PHPUnit_Framework_Assert::assertJsonStringNotEqualsJsonFile in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php
Asserts that the generated JSON encoded object and the content of the given file are not equal.

... See full list

File

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

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertJson($expectedJson, $message = '') {
  if (!is_string($expectedJson)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
  }
  self::assertThat($expectedJson, self::isJson(), $message);
}