123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace Composer\Test\Json;
- use Composer\Json\JsonFormatter;
- use Composer\Test\TestCase;
- class JsonFormatterTest extends TestCase
- {
-
- public function testUnicodeWithPrependedSlash()
- {
- if (!extension_loaded('mbstring')) {
- $this->markTestSkipped('Test requires the mbstring extension');
- }
- $backslash = chr(92);
- $data = '"' . $backslash . $backslash . $backslash . 'u0119"';
- $expected = '"' . $backslash . $backslash . 'ę"';
- $this->assertEquals($expected, JsonFormatter::format($data, true, true));
- }
-
- public function testUtf16SurrogatePair()
- {
- if (!extension_loaded('mbstring')) {
- $this->markTestSkipped('Test requires the mbstring extension');
- }
- $escaped = '"\ud83d\ude00"';
- $this->assertEquals($escaped, JsonFormatter::format($escaped, true, true));
- }
- }
|