Make WordPress Core


Ignore:
Timestamp:
04/20/2015 11:31:22 AM (9 years ago)
Author:
pento
Message:

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

Props pento, nacin, mdawaffe, DrewAPicture.

File:
1 edited

Legend:

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

    r25975 r32186  
    830830        return $counts;
    831831    }
     832
     833    /**
     834     * @ticket 21212
     835     */
     836    function test_utf8mb3_post_saves_with_emoji() {
     837        global $wpdb;
     838        $_wpdb = new wpdb_exposed_methods_for_testing();
     839
     840        if ( 'utf8' !== $_wpdb->get_col_charset( $wpdb->posts, 'post_title' ) ) {
     841            $this->markTestSkipped( 'This test is only useful with the utf8 character set' );
     842        }
     843
     844        require_once( ABSPATH . '/wp-admin/includes/post.php' );
     845
     846        $post_id = $this->factory->post->create();
     847
     848        $data = array(
     849            'post_ID'      => $post_id,
     850            'post_title'   => "foo\xf0\x9f\x98\x88bar",
     851            'post_content' => "foo\xf0\x9f\x98\x8ebaz",
     852            'post_excerpt' => "foo\xf0\x9f\x98\x90bat"
     853        );
     854
     855        $expected = array(
     856            'post_title'   => "foobar",
     857            'post_content' => "foobaz",
     858            'post_excerpt' => "foobat"
     859        );
     860
     861        edit_post( $data );
     862
     863        $post = get_post( $post_id );
     864
     865        foreach( $expected as $field => $value ) {
     866            $this->assertEquals( $post->$field, $value );
     867        }
     868    }
    832869}
Note: See TracChangeset for help on using the changeset viewer.