MediaWiki
master
|
Public Member Functions | |
testParseTryFixing ( $value, $expected, $jsoncParses=true, $expectedJsonc=null) | |
provideParseTryFixing More... | |
Static Public Member Functions | |
static | provideParseTryFixing () |
Test data for testParseTryFixing. More... | |
Additional Inherited Members | |
![]() | |
setUp () | |
tearDown () | |
Definition at line 6 of file FormatJsonTest.php.
|
static |
Test data for testParseTryFixing.
Some PHP interpreters use json-c rather than the JSON.org canonical parser to avoid being encumbered by the "shall be used for Good, not Evil" clause of the JSON.org parser's license. By default, json-c parses in a non-strict mode which allows trailing commas for array and object delarations among other things, so our JSON_ERROR_SYNTAX rescue block is not always triggered. It however isn't lenient in exactly the same ways as our TRY_FIXING mode, so the assertions in this test are a bit more complicated than they ideally would be:
Optional third argument: true if json-c parses the value without intervention, false otherwise. Defaults to true.
Optional fourth argument: expected cannonical JSON serialization of json-c parsed result. Defaults to the second argument's value.
Definition at line 26 of file FormatJsonTest.php.
References false.
FormatJsonTest::testParseTryFixing | ( | $value, | |
$expected, | |||
$jsoncParses = true , |
|||
$expectedJsonc = null |
|||
) |
provideParseTryFixing
string | $value | |
string | bool | $expected | Expected result with strict parser |
bool | $jsoncParses | Will json-c parse this value without TRY_FIXING? |
string | bool | $expectedJsonc | Expected result with lenient parser if different from the strict expectation |
Definition at line 53 of file FormatJsonTest.php.
References $value, FormatJson\ALL_OK, class, FormatJson\encode(), null, FormatJson\parse(), and FormatJson\TRY_FIXING.