Changeset 25278 for trunk/tests/phpunit/tests/term/query.php
- Timestamp:
- 09/06/2013 02:43:49 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/query.php
r25238 r25278 38 38 $this->assertEmpty( $posts2 ); 39 39 } 40 41 function test_taxonomy_with_attachments() { 42 register_taxonomy_for_object_type( 'post_tag', 'attachment:image' ); 43 $tag_id = $this->factory->term->create( array( 'slug' => rand_str(), 'name' => rand_str() ) ); 44 $image_id = $this->factory->attachment->create_object( 'image.jpg', 0, array( 45 'post_mime_type' => 'image/jpeg', 46 'post_type' => 'attachment' 47 ) ); 48 wp_set_object_terms( $image_id, $tag_id, 'post_tag' ); 49 50 $posts = $this->q->query( array( 51 'fields' => 'ids', 52 'post_type' => 'attachment', 53 'post_status' => 'inherit', 54 'tax_query' => array( 55 array( 56 'taxonomy' => 'post_tag', 57 'field' => 'term_id', 58 'terms' => array( $tag_id ) 59 ) 60 ) 61 ) ); 62 63 $this->assertEquals( array( $image_id ), $posts ); 64 } 40 65 }
Note: See TracChangeset
for help on using the changeset viewer.