Make WordPress Core


Ignore:
Timestamp:
04/20/2015 11:08:17 AM (11 years ago)
Author:
pento
Message:

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

Props pento, nacin, mdawaffe, DrewAPicture.

File:
1 edited

Legend:

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

    r27720 r32182  
    914914
    915915}
     916
     917    /**
     918     * @ticket 21212
     919     */
     920    function test_utf8mb3_post_saves_with_emoji() {
     921        global $wpdb;
     922        $_wpdb = new wpdb_exposed_methods_for_testing();
     923
     924        if ( 'utf8' !== $_wpdb->get_col_charset( $wpdb->posts, 'post_title' ) ) {
     925            $this->markTestSkipped( 'This test is only useful with the utf8 character set' );
     926        }
     927
     928        require_once( ABSPATH . '/wp-admin/includes/post.php' );
     929
     930        $post_id = $this->factory->post->create();
     931
     932        $data = array(
     933            'post_ID'      => $post_id,
     934            'post_title'   => "foo\xf0\x9f\x98\x88bar",
     935            'post_content' => "foo\xf0\x9f\x98\x8ebaz",
     936            'post_excerpt' => "foo\xf0\x9f\x98\x90bat"
     937        );
     938
     939        $expected = array(
     940            'post_title'   => "foobar",
     941            'post_content' => "foobaz",
     942            'post_excerpt' => "foobat"
     943        );
     944
     945        edit_post( $data );
     946
     947        $post = get_post( $post_id );
     948
     949        foreach( $expected as $field => $value ) {
     950            $this->assertEquals( $post->$field, $value );
     951        }
     952    }
Note: See TracChangeset for help on using the changeset viewer.