Make WordPress Core


Ignore:
Timestamp:
09/16/2015 06:49:28 PM (9 years ago)
Author:
boonebgorges
Message:

Failed get_term_by() lookups should always return false.

Previously, we sometimes returned null.

Props charlestonsw, tyxla.
Fixes #33281.

File:
1 edited

Legend:

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

    r32507 r34246  
    5656        $term2 = get_term_by( 'term_taxonomy_id', $term1['term_taxonomy_id'], 'category' );
    5757        $this->assertEquals( get_term( $term1['term_id'], 'category' ), $term2 );
     58    }
     59
     60    /**
     61     * @ticket 33281
     62     */
     63    function test_get_term_by_with_nonexistent_id_should_return_false() {
     64        $term = get_term_by( 'id', 123456, 'category' );
     65        $this->assertFalse( $term );
    5866    }
    5967
Note: See TracChangeset for help on using the changeset viewer.