Documentation

JsonTestCase extends PHPUnit_Framework_TestCase
in package

AbstractYes

A JSON Test Case

This class extends with an assertion to compare JSON.

Tags
author

Markus Lanthaler mail@markus-lanthaler.com

Table of Contents

Methods

assertJsonEquals()  : mixed
Asserts that two JSON structures are equal.
normalizeJson()  : mixed
Brings the keys of objects to a deterministic order to enable comparison of JSON structures

Methods

assertJsonEquals()

Asserts that two JSON structures are equal.

public static assertJsonEquals(object|array<string|int, mixed> $expected, object|array<string|int, mixed> $actual[, string $message = '' ]) : mixed
Parameters
$expected : object|array<string|int, mixed>
$actual : object|array<string|int, mixed>
$message : string = ''

normalizeJson()

Brings the keys of objects to a deterministic order to enable comparison of JSON structures

private static normalizeJson(mixed $element) : mixed
Parameters
$element : mixed

The element to normalize.

Return values
mixed

The same data with all object keys ordered in a deterministic way.


        
On this page

Search results