Changeset 53836 for trunk/tests/phpunit/tests/term/getTermLink.php
- Timestamp:
- 08/04/2022 06:28:33 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/getTermLink.php
r53833 r53836 21 21 parent::set_up(); 22 22 self::register_custom_taxonomy(); 23 } 24 25 /** 26 * Helper to register a custom taxonomy for use in tests. 27 * 28 * @since 5.9.0 29 */ 30 private static function register_custom_taxonomy() { 31 register_taxonomy( 'wptests_tax', 'post' ); 32 } 33 34 /** 35 * Helper to get the term for the given taxonomy. 36 * 37 * @since 5.9.0 38 * 39 * @param string $taxonomy Taxonomy being tested (used for index of term keys). 40 * @param bool $use_id When true, pass term ID. Else, pass term object. 41 * @return WP_Term|int If $use_id is true, term ID is returned; else instance of WP_Term. 42 */ 43 private function get_term( $taxonomy, $use_id ) { 44 $term = self::$terms[ $taxonomy ]; 45 if ( $use_id ) { 46 $term = $term->term_id; 47 } 48 49 return $term; 23 50 } 24 51 … … 321 348 ); 322 349 } 323 324 /**325 * Helper to register a custom taxonomy for use in tests.326 *327 * @since 5.9.0328 */329 private static function register_custom_taxonomy() {330 register_taxonomy( 'wptests_tax', 'post' );331 }332 333 /**334 * Helper to get the term for the given taxonomy.335 *336 * @since 5.9.0337 *338 * @param string $taxonomy Taxonomy being tested (used for index of term keys).339 * @param bool $use_id When true, pass term ID. Else, pass term object.340 * @return WP_Term|int If $use_id is true, term ID is returned; else instance of WP_Term.341 */342 private function get_term( $taxonomy, $use_id ) {343 $term = self::$terms[ $taxonomy ];344 if ( $use_id ) {345 $term = $term->term_id;346 }347 348 return $term;349 }350 350 }
Note: See TracChangeset
for help on using the changeset viewer.