MediaWiki  REL1_21
JsonTest.php
Go to the documentation of this file.
00001 <?php
00002 
00003 class JsonTest extends MediaWikiTestCase {
00004 
00005         function testPhpBug46944Test() {
00006                 $this->assertNotEquals(
00007                         '\ud840\udc00',
00008                         strtolower( FormatJson::encode( "\xf0\xa0\x80\x80" ) ),
00009                         'Test encoding an broken json_encode character (U+20000)'
00010                 );
00011 
00012         }
00013 
00014         function testDecodeVarTypes() {
00015                 $this->assertInternalType(
00016                         'object',
00017                         FormatJson::decode( '{"Name": "Cheeso", "Rank": 7}' ),
00018                         'Default to object'
00019                 );
00020 
00021                 $this->assertInternalType(
00022                         'array',
00023                         FormatJson::decode( '{"Name": "Cheeso", "Rank": 7}', true ),
00024                         'Optional array'
00025                 );
00026         }
00027 }