Index: trunk/phase3/tests/phpunit/includes/JsonTest.php |
— | — | @@ -0,0 +1,33 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class JsonTest extends MediaWikiTestCase { |
| 5 | + |
| 6 | + function testPHPBug46944Test() { |
| 7 | + |
| 8 | + $this->assertNotEquals( |
| 9 | + '\ud840\udc00', |
| 10 | + strtolower( FormatJson::encode( "\xf0\xa0\x80\x80" ) ), |
| 11 | + 'Test encoding an broken json_encode character (U+20000)' |
| 12 | + ); |
| 13 | + |
| 14 | + |
| 15 | + } |
| 16 | + |
| 17 | + function testDecodeVarTypes() { |
| 18 | + |
| 19 | + $this->assertInternalType( |
| 20 | + 'object', |
| 21 | + FormatJson::decode( '{"Name": "Cheeso", "Rank": 7}' ), |
| 22 | + 'Default to object' |
| 23 | + ); |
| 24 | + |
| 25 | + $this->assertInternalType( |
| 26 | + 'array', |
| 27 | + FormatJson::decode( '{"Name": "Cheeso", "Rank": 7}', true ), |
| 28 | + 'Optional array' |
| 29 | + ); |
| 30 | + |
| 31 | + } |
| 32 | + |
| 33 | +} |
| 34 | + |
Property changes on: trunk/phase3/tests/phpunit/includes/JsonTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 35 | + native |