Make WordPress Core

Ticket #30284: 28786-remove.diff

File 28786-remove.diff, 1.5 KB (added by MikeHansenMe, 10 years ago)

#28786

  • tests/phpunit/tests/functions.php

    diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
    index c52623e..a44d2b6 100644
    a b class Tests_Functions extends WP_UnitTestCase { 
    529529                $this->assertCount( 8, $urls );
    530530                $this->assertEquals( array_slice( $original_urls, 0, 8 ), $urls );
    531531        }
    532 
    533         /**
    534          * @ticket 28786
    535          */
    536         function test_wp_json_encode() {
    537                 $this->assertEquals( wp_json_encode( 'a' ), '"a"' );
    538                 $this->assertEquals( wp_json_encode( '这' ), '"\u8fd9"' );
    539 
    540                 $old_charsets = $charsets = mb_detect_order();
    541                 if ( ! in_array( 'EUC-JP', $charsets ) ) {
    542                         $charsets[] = 'EUC-JP';
    543                         mb_detect_order( $charsets );
    544                 }
    545 
    546                 $eucjp = mb_convert_encoding( 'aあb', 'EUC-JP', 'UTF-8' );
    547                 $utf8 = mb_convert_encoding( $eucjp, 'UTF-8', 'EUC-JP' );
    548 
    549                 $this->assertEquals( 'aあb', $utf8 );
    550 
    551                 $this->assertEquals( wp_json_encode( $eucjp ), '"a\u3042b"' );
    552 
    553                 $this->assertEquals( wp_json_encode( array( 'a' ) ), '["a"]' );
    554 
    555                 $object = new stdClass;
    556                 $object->a = 'b';
    557                 $this->assertEquals( wp_json_encode( $object ), '{"a":"b"}' );
    558 
    559                 mb_detect_order( $old_charsets );
    560         }
    561 
    562         /**
    563          * @ticket 28786
    564          */
    565         function test_wp_json_encode_depth() {
    566                 $data = array( array( array( 1, 2, 3 ) ) );
    567                 $json = wp_json_encode( $data, 0, 1 );
    568                 $this->assertFalse( $json );
    569 
    570                 $data = array( 'あ', array( array( 1, 2, 3 ) ) );
    571                 $json = wp_json_encode( $data, 0, 1 );
    572                 $this->assertFalse( $json );
    573         }
    574532}