From: X! Date: Mon, 3 Jan 2011 21:14:51 +0000 (+0000) Subject: Add JSON test case X-Git-Tag: 1.31.0-rc.0~32852 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=4ffe303e4f7365033076261924540ec44ad3e444;p=lhc%2Fweb%2Fwiklou.git Add JSON test case --- diff --git a/tests/phpunit/includes/JsonTest.php b/tests/phpunit/includes/JsonTest.php new file mode 100644 index 0000000000..bec755db21 --- /dev/null +++ b/tests/phpunit/includes/JsonTest.php @@ -0,0 +1,33 @@ +assertNotEquals( + '\ud840\udc00', + strtolower( FormatJson::encode( "\xf0\xa0\x80\x80" ) ), + 'Test encoding an broken json_encode character (U+20000)' + ); + + + } + + function testDecodeVarTypes() { + + $this->assertInternalType( + 'object', + FormatJson::decode( '{"Name": "Cheeso", "Rank": 7}' ), + 'Default to object' + ); + + $this->assertInternalType( + 'array', + FormatJson::decode( '{"Name": "Cheeso", "Rank": 7}', true ), + 'Optional array' + ); + + } + +} +