Changeset 40994 for trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
- Timestamp:
- 07/02/2017 06:28:21 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
r40290 r40994 733 733 $this->assertEquals( array( $t1, $t3, $t2 ), $found ); 734 734 } 735 736 /** 737 * @ticket 35925 738 */ 739 public function test_wp_get_object_terms_args_filter() { 740 $taxonomy = 'wptests_tax_4'; 741 742 register_taxonomy( $taxonomy, 'post', array( 'sort' => 'true' ) ); 743 $post_id = self::factory()->post->create(); 744 $terms = array( 'foo', 'bar', 'baz' ); 745 $set = wp_set_object_terms( $post_id, $terms, $taxonomy ); 746 747 // Filter for maintaining term order 748 add_filter( 'wp_get_object_terms_args', array( $this, 'filter_wp_get_object_terms_args' ), 10, 3 ); 749 750 // Test directly 751 $get_object_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'names' ) ); 752 $this->assertEquals( $terms, $get_object_terms ); 753 754 // Test metabox taxonomy (admin advanced edit) 755 $terms_to_edit = get_terms_to_edit( $post_id, $taxonomy ); 756 $this->assertEquals( implode( ',', $terms ), $terms_to_edit ); 757 } 758 759 function filter_wp_get_object_terms_args ( $args, $object_ids, $taxonomies ) { 760 $args['orderby'] = 'term_order'; 761 return $args; 762 } 735 763 }
Note: See TracChangeset
for help on using the changeset viewer.