Make WordPress Core


Ignore:
Timestamp:
04/20/2015 10:53:33 AM (10 years ago)
Author:
pento
Message:

Merge the query sanity checks from #21212 to the 4.0 branch.

Props pento, nacin, mdawaffe, DrewAPicture.

File:
1 edited

Legend:

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

    r29351 r32181  
    993993
    994994}
     995
     996    /**
     997     * @ticket 21212
     998     */
     999    function test_utf8mb3_post_saves_with_emoji() {
     1000        global $wpdb;
     1001        $_wpdb = new wpdb_exposed_methods_for_testing();
     1002
     1003        if ( 'utf8' !== $_wpdb->get_col_charset( $wpdb->posts, 'post_title' ) ) {
     1004            $this->markTestSkipped( 'This test is only useful with the utf8 character set' );
     1005        }
     1006
     1007        require_once( ABSPATH . '/wp-admin/includes/post.php' );
     1008
     1009        $post_id = $this->factory->post->create();
     1010
     1011        $data = array(
     1012            'post_ID'      => $post_id,
     1013            'post_title'   => "foo\xf0\x9f\x98\x88bar",
     1014            'post_content' => "foo\xf0\x9f\x98\x8ebaz",
     1015            'post_excerpt' => "foo\xf0\x9f\x98\x90bat"
     1016        );
     1017
     1018        $expected = array(
     1019            'post_title'   => "foobar",
     1020            'post_content' => "foobaz",
     1021            'post_excerpt' => "foobat"
     1022        );
     1023
     1024        edit_post( $data );
     1025
     1026        $post = get_post( $post_id );
     1027
     1028        foreach( $expected as $field => $value ) {
     1029            $this->assertEquals( $post->$field, $value );
     1030        }
     1031    }
Note: See TracChangeset for help on using the changeset viewer.