mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 06:37:06 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@32659 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -252,6 +252,12 @@ class WP_UnitTest_Factory_For_Term extends WP_UnitTest_Factory_For_Thing {
|
||||
return wp_set_post_terms( $post_id, $terms, $taxonomy, $append );
|
||||
}
|
||||
|
||||
function create_and_get( $args = array(), $generation_definitions = null ) {
|
||||
$term_id = $this->create( $args, $generation_definitions );
|
||||
$taxonomy = isset( $args['taxonomy'] ) ? $args['taxonomy'] : $this->taxonomy;
|
||||
return get_term( $term_id, $taxonomy );
|
||||
}
|
||||
|
||||
function get_object_by_id( $term_id ) {
|
||||
return get_term( $term_id, $this->taxonomy );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user