Changeset 40445
- Timestamp:
- 04/15/2017 07:35:46 PM (7 years ago)
- Location:
- branches/4.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0
-
branches/4.0/tests/phpunit/tests/term/query.php
r28783 r40445 62 62 63 63 $this->assertEquals( array( $image_id ), $posts ); 64 }65 66 /**67 * @ticket 2719368 */69 function test_cat_or_tag() {70 $category1 = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'alpha' ) );71 $category2 = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'beta' ) );72 73 $tag1 = $this->factory->term->create( array( 'taxonomy' => 'post_tag', 'name' => 'gamma' ) );74 $tag2 = $this->factory->term->create( array( 'taxonomy' => 'post_tag', 'name' => 'delta' ) );75 76 $post_id1 = $this->factory->post->create( array( 'post_title' => 'alpha', 'post_category' => array( $category1 ) ) );77 $terms1 = get_the_category( $post_id1 );78 $this->assertEquals( array( get_category( $category1 ) ), $terms1 );79 80 $post_id2 = $this->factory->post->create( array( 'post_title' => 'beta', 'post_category' => array( $category2 ) ) );81 $terms2 = get_the_category( $post_id2 );82 $this->assertEquals( array( get_category( $category2 ) ), $terms2 );83 84 $post_id3 = $this->factory->post->create( array( 'post_title' => 'gamma', 'post_tag' => array( $tag1 ) ) );85 $post_id4 = $this->factory->post->create( array( 'post_title' => 'delta', 'post_tag' => array( $tag2 ) ) );86 87 $query = new WP_Query( array(88 'fields' => 'ids',89 'tax_query' => array(90 //'relation' => 'OR',91 array(92 'taxonomy' => 'category',93 'field' => 'term_id',94 'terms' => array( $category1, $category2 )95 )96 )97 ) );98 $ids = $query->get_posts();99 $this->assertEquals( array( $post_id1, $post_id2 ), $ids );100 64 } 101 65
Note: See TracChangeset
for help on using the changeset viewer.