WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/30/2015 01:03:07 PM (5 years ago)
Author:
boonebgorges
Message:

Term unit test factory class should override create_and_get() method.

The override is necessary because the get_term() call, which fetches the
term object, needs the 'taxonomy' argument passed to the factory method.

Props dlh.
Fixes #32536.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/factory.php

    r27178 r32659  
    251251    function add_post_terms( $post_id, $terms, $taxonomy, $append = true ) {
    252252        return wp_set_post_terms( $post_id, $terms, $taxonomy, $append );
     253    }
     254
     255    function create_and_get( $args = array(), $generation_definitions = null ) {
     256        $term_id = $this->create( $args, $generation_definitions );
     257        $taxonomy = isset( $args['taxonomy'] ) ? $args['taxonomy'] : $this->taxonomy;
     258        return get_term( $term_id, $taxonomy );
    253259    }
    254260
Note: See TracChangeset for help on using the changeset viewer.