WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/21/2013 04:47:43 PM (8 years ago)
Author:
wonderboymusic
Message:

Ensure that terms with a post count of 0 are not returned in wp_count_terms() when hide_empty => true. Adds unit test which ensures that wp_count_terms() returns 0.

Props markjaquith.
Fixes #15919.

File:
1 edited

Legend:

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

    r25334 r25551  
    506506        $this->assertEquals( get_term( $term1['term_id'], 'category' ), $term2 );
    507507    }
     508
     509    function test_wp_count_terms() {
     510        $count = wp_count_terms( 'category', array( 'hide_empty' => true ) );
     511        // the terms inserted in setUp aren't attached to any posts, so should return 0
     512        // this previously returned 2
     513        $this->assertEquals( 0, $count );
     514    }
    508515}
Note: See TracChangeset for help on using the changeset viewer.