Changeset 30533
- Timestamp:
- 11/23/2014 11:51:13 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions.php
r30520 r30533 531 531 function test_wp_json_encode() { 532 532 $this->assertEquals( wp_json_encode( 'a' ), '"a"' ); 533 } 534 535 /** 536 * @ticket 28786 537 */ 538 function test_wp_json_encode_utf8() { 533 539 $this->assertEquals( wp_json_encode( '这' ), '"\u8fd9"' ); 540 } 541 542 /** 543 * @ticket 28786 544 */ 545 function test_wp_json_encode_non_utf8() { 546 if ( version_compare( PHP_VERSION, '5.4', '<' ) ) { 547 $this->markTestSkipped( 'EUC-JP character set added in PHP 5.4' ); 548 }; 534 549 535 550 $old_charsets = $charsets = mb_detect_order(); … … 546 561 $this->assertEquals( wp_json_encode( $eucjp ), '"a\u3042b"' ); 547 562 563 mb_detect_order( $old_charsets ); 564 } 565 566 /** 567 * @ticket 28786 568 */ 569 function test_wp_json_encode_array() { 548 570 $this->assertEquals( wp_json_encode( array( 'a' ) ), '["a"]' ); 549 571 } 572 573 /** 574 * @ticket 28786 575 */ 576 function test_wp_json_encode_object() { 550 577 $object = new stdClass; 551 578 $object->a = 'b'; 552 579 $this->assertEquals( wp_json_encode( $object ), '{"a":"b"}' ); 553 554 mb_detect_order( $old_charsets );555 580 } 556 581 … … 559 584 */ 560 585 function test_wp_json_encode_depth() { 586 if ( version_compare( PHP_VERSION, '5.5', '<' ) ) { 587 $this->markTestSkipped( 'json_encode() supports the $depth parameter in PHP 5.5+' ); 588 }; 589 561 590 $data = array( array( array( 1, 2, 3 ) ) ); 562 591 $json = wp_json_encode( $data, 0, 1 );
Note: See TracChangeset
for help on using the changeset viewer.