WordPress.org

Make WordPress Core

Ticket #18210: 18210.diff

File 18210.diff, 1.2 KB (added by kdoole, 5 years ago)

Added tests for the cases @anmari describes

  • tests/phpunit/tests/post/meta.php

     
    243243                $this->assertEquals($funky_meta, get_post_meta($this->post_id, 'test_funky_post_meta', true));
    244244
    245245        }
     246
     247        /**
     248         * @ticket 18210
     249         */
     250        function test_case_insensitive_collation_inconsistencies() {
     251                $this->assertInternalType( 'integer', add_post_meta( $this->post_id, 'ALLDAY', 'value' ) );
     252                $this->assertInternalType( 'integer', add_post_meta( $this->post_id_2, 'ALLDAY', 'value' ) );
     253
     254                $this->assertTrue( update_post_meta( $this->post_id, 'allday', 'update using lowercase' ) );
     255
     256                $this->assertEquals( 'value', get_post_meta( $this->post_id, 'ALLDAY', true ) );
     257                $this->assertEquals( 'update using lowercase', get_post_meta( $this->post_id, 'allday', true ) );
     258
     259                $posts = get_posts( 'meta_key=allday' );
     260                $this->assertEquals( 1, count( $posts ) );
     261
     262                $this->assertTrue( delete_post_meta( $this->post_id, 'allday' ) );
     263                $this->assertEquals( 'update using lowercase', get_post_meta( $this->post_id, 'ALLDAY', true ) );
     264                $this->assertEquals( '', get_post_meta( $this->post_id, 'allday', true ) );
     265
     266
     267        }
    246268}