Changeset 26510 for trunk/tests/phpunit/tests/term.php
- Timestamp:
- 12/01/2013 11:59:13 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/term.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term.php
r26187 r26510 9 9 function setUp() { 10 10 parent::setUp(); 11 11 12 12 _clean_term_filters(); 13 13 // insert one term into every post taxonomy … … 86 86 // clean up 87 87 $this->assertTrue( wp_delete_term($t['term_id'], $this->taxonomy) ); 88 } 89 90 function test_get_object_terms() { 91 $post_id = $this->factory->post->create(); 92 $terms_1 = array('foo', 'bar', 'baz'); 93 94 wp_set_object_terms( $post_id, $terms_1, $this->taxonomy ); 95 add_filter( 'wp_get_object_terms', array( $this, 'filter_get_object_terms' ) ); 96 $terms = wp_get_object_terms( $post_id, $this->taxonomy ); 97 remove_filter( 'wp_get_object_terms', array( $this, 'filter_get_object_terms' ) ); 98 foreach ( $terms as $term ) { 99 $this->assertInternalType( 'object', $term ); 100 } 101 } 102 103 function filter_get_object_terms( $terms ) { 104 // var_dump reveals an array of objects 105 $term_ids = wp_list_pluck( $terms, 'term_id' ); 106 // last term is now an integer 107 return $terms; 88 108 } 89 109
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)