Make WordPress Core

Ticket #33864: 33731.patch

File 33731.patch, 1.1 KB (added by tyxla, 8 years ago)

Adding unit tests for the 2 cases: term with accent, followed by term without accent; term without accent, followed by term with accent.

  • tests/phpunit/tests/term/wpInsertTerm.php

     
    619619                $this->assertTrue( in_array( $found['term_id'], $cached_children[ $t ] ) );
    620620        }
    621621
     622        /**
     623         * @ticket 33864
     624         */
     625        public function test_wp_insert_term_with_and_without_accents() {
     626                $t1 = wp_insert_term( 'Foó', 'category' );
     627                $t2 = wp_insert_term( 'Foo', 'category' );
     628
     629                $this->assertInternalType( 'array', $t2 );
     630                $this->assertArrayHasKey( 'term_id', $t2 );
     631                $this->assertNotEquals( $t1['term_id'], $t2['term_id'] );
     632
     633                $t3 = wp_insert_term( 'FooBar', 'category' );
     634                $t4 = wp_insert_term( 'FóoBar', 'category' );
     635               
     636                $this->assertInternalType( 'array', $t4 );
     637                $this->assertArrayHasKey( 'term_id', $t4 );
     638                $this->assertNotEquals( $t3['term_id'], $t4['term_id'] );
     639        }
     640
    622641        /** Helpers **********************************************************/
    623642
    624643        public function deleted_term_cb( $term, $tt_id, $taxonomy, $deleted_term ) {