You are here

public static function PHPUnit_Framework_Assert::assertJson in Zircon Profile 8

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

Asserts that a string is a valid JSON string.

@since Method available since Release 3.7.20

Parameters

string $actualJson:

string $message:

8 calls to PHPUnit_Framework_Assert::assertJson()
Framework_AssertTest::testAssertJson in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertJson
Framework_AssertTest::testAssertJsonRaisesExceptionForInvalidArgument in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertJson @expectedException PHPUnit_Framework_Exception
PHPUnit_Framework_Assert::assertJsonFileEqualsJsonFile in vendor/phpunit/phpunit/src/Framework/Assert.php
Asserts that two JSON files are equal.
PHPUnit_Framework_Assert::assertJsonFileNotEqualsJsonFile in vendor/phpunit/phpunit/src/Framework/Assert.php
Asserts that two JSON files are not equal.
PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile in vendor/phpunit/phpunit/src/Framework/Assert.php
Asserts that the generated JSON encoded object and the content of the given file are equal.

... See full list

File

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

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

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