Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/tests/phpunit/tests/post.php

    r30807 r32180  
    10321032        _unregister_post_type( 'post-type-1' );
    10331033    }
     1034
     1035    /**
     1036     * @ticket 21212
     1037     */
     1038    function test_utf8mb3_post_saves_with_emoji() {
     1039        global $wpdb;
     1040        $_wpdb = new wpdb_exposed_methods_for_testing();
     1041
     1042        if ( 'utf8' !== $_wpdb->get_col_charset( $wpdb->posts, 'post_title' ) ) {
     1043            $this->markTestSkipped( 'This test is only useful with the utf8 character set' );
     1044        }
     1045
     1046        require_once( ABSPATH . '/wp-admin/includes/post.php' );
     1047
     1048        $post_id = $this->factory->post->create();
     1049
     1050        $data = array(
     1051            'post_ID'      => $post_id,
     1052            'post_title'   => "foo\xf0\x9f\x98\x88bar",
     1053            'post_content' => "foo\xf0\x9f\x98\x8ebaz",
     1054            'post_excerpt' => "foo\xf0\x9f\x98\x90bat"
     1055        );
     1056
     1057        $expected = array(
     1058            'post_title'   => "foobar",
     1059            'post_content' => "foobaz",
     1060            'post_excerpt' => "foobat"
     1061        );
     1062
     1063        edit_post( $data );
     1064
     1065        $post = get_post( $post_id );
     1066
     1067        foreach( $expected as $field => $value ) {
     1068            $this->assertEquals( $post->$field, $value );
     1069        }
     1070    }
    10341071}
Note: See TracChangeset for help on using the changeset viewer.