- Timestamp:
- 03/15/2019 12:15:08 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-term.php
r44497 r44903 15 15 const DEFAULT_TAXONOMY = 'post_tag'; 16 16 17 function __construct( $factory = null, $taxonomy = null ) {17 public function __construct( $factory = null, $taxonomy = null ) { 18 18 parent::__construct( $factory ); 19 19 $this->taxonomy = $taxonomy ? $taxonomy : self::DEFAULT_TAXONOMY; … … 32 32 * @return array|WP_Error 33 33 */ 34 function create_object( $args ) {34 public function create_object( $args ) { 35 35 $args = array_merge( array( 'taxonomy' => $this->taxonomy ), $args ); 36 36 $term_id_pair = wp_insert_term( $args['name'], $args['taxonomy'], $args ); … … 49 49 * @return int The term id. 50 50 */ 51 function update_object( $term, $fields ) {51 public function update_object( $term, $fields ) { 52 52 $fields = array_merge( array( 'taxonomy' => $this->taxonomy ), $fields ); 53 53 if ( is_object( $term ) ) { … … 72 72 * @return array|false|WP_Error Array of term taxonomy IDs of affected terms. WP_Error or false on failure. 73 73 */ 74 function add_post_terms( $post_id, $terms, $taxonomy, $append = true ) {74 public function add_post_terms( $post_id, $terms, $taxonomy, $append = true ) { 75 75 return wp_set_post_terms( $post_id, $terms, $taxonomy, $append ); 76 76 } … … 84 84 * @return null|WP_Error|WP_Term WP_Term on success. WP_error if taxonomy does not exist. Null for miscellaneous failure. 85 85 */ 86 function create_and_get( $args = array(), $generation_definitions = null ) {86 public function create_and_get( $args = array(), $generation_definitions = null ) { 87 87 $term_id = $this->create( $args, $generation_definitions ); 88 88 $taxonomy = isset( $args['taxonomy'] ) ? $args['taxonomy'] : $this->taxonomy; … … 97 97 * @return null|WP_Error|WP_Term WP_Term on success. WP_error if taxonomy does not exist. Null for miscellaneous failure. 98 98 */ 99 function get_object_by_id( $term_id ) {99 public function get_object_by_id( $term_id ) { 100 100 return get_term( $term_id, $this->taxonomy ); 101 101 }
Note: See TracChangeset
for help on using the changeset viewer.