From 4ffe303e4f7365033076261924540ec44ad3e444 Mon Sep 17 00:00:00 2001 From: X! Date: Mon, 3 Jan 2011 21:14:51 +0000 Subject: [PATCH] Add JSON test case --- tests/phpunit/includes/JsonTest.php | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/phpunit/includes/JsonTest.php 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' + ); + + } + +} + -- 2.20.1