Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Assert.php

function Assert::assertJson

Asserts that a string is a valid JSON string.

Throws

ExpectationFailedException

7 calls to Assert::assertJson()
Assert::assertJsonFileEqualsJsonFile in vendor/phpunit/phpunit/src/Framework/Assert.php
Asserts that two JSON files are equal.
Assert::assertJsonFileNotEqualsJsonFile in vendor/phpunit/phpunit/src/Framework/Assert.php
Asserts that two JSON files are not equal.
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.
Assert::assertJsonStringEqualsJsonString in vendor/phpunit/phpunit/src/Framework/Assert.php
Asserts that two given JSON encoded objects or arrays are equal.
Assert::assertJsonStringNotEqualsJsonFile in vendor/phpunit/phpunit/src/Framework/Assert.php
Asserts that the generated JSON encoded object and the content of the given file are not equal.

... See full list

File

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

Class

Assert
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\Framework

Code

public static final function assertJson(string $actual, string $message = '') : void {
    static::assertThat($actual, static::isJson(), $message);
}
RSS feed
Powered by Drupal