Changeset 25278
- Timestamp:
- 09/06/2013 02:43:49 PM (11 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory.php
r25002 r25278 85 85 class WP_UnitTest_Factory_For_Attachment extends WP_UnitTest_Factory_For_Post { 86 86 87 88 89 87 function create_object( $file, $parent = 0, $args = array() ) { 88 return wp_insert_attachment( $args, $file, $parent ); 89 } 90 90 } 91 91 -
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.