Make WordPress Core


Ignore:
Timestamp:
08/29/2013 04:49:43 PM (12 years ago)
Author:
wonderboymusic
Message:

Search term name and slug when the search arg is passed to get_terms(). Adds unit test.

Props wojtek.szkutnik.
Fixes #13992.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/tests/term/getTerms.php

    r25162 r25164  
    140140        $this->assertEquals( array(), wp_list_pluck( $exc_terms, 'term_id' ) );
    141141    }
     142
     143    /**
     144     * @ticket 13992
     145     */
     146    function test_get_terms_search() {
     147        $term_id1 = $this->factory->tag->create( array( 'slug' => 'burrito' ) );
     148        $term_id2 = $this->factory->tag->create( array( 'name' => 'Wilbur' ) );
     149
     150        $terms = get_terms( 'post_tag', array( 'hide_empty' => false, 'search' => 'bur', 'fields' => 'ids' ) );
     151        $this->assertEqualSets( array( $term_id1, $term_id2 ), $terms );
     152    }
    142153}
Note: See TracChangeset for help on using the changeset viewer.