Changeset 29979 for trunk/tests/phpunit/tests/post/query.php
- Timestamp:
- 10/21/2014 01:40:27 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/query.php
r29964 r29979 2631 2631 2632 2632 /** 2633 * @ticket 271932634 * @group taxonomy2635 */2636 function test_cat_or_tag() {2637 $category1 = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'alpha' ) );2638 $category2 = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'beta' ) );2639 2640 $tag1 = $this->factory->term->create( array( 'taxonomy' => 'post_tag', 'name' => 'gamma' ) );2641 $tag2 = $this->factory->term->create( array( 'taxonomy' => 'post_tag', 'name' => 'delta' ) );2642 2643 $post_id1 = $this->factory->post->create( array( 'post_title' => 'alpha', 'post_category' => array( $category1 ) ) );2644 $terms1 = get_the_category( $post_id1 );2645 $this->assertEquals( array( get_category( $category1 ) ), $terms1 );2646 2647 $post_id2 = $this->factory->post->create( array( 'post_title' => 'beta', 'post_category' => array( $category2 ) ) );2648 $terms2 = get_the_category( $post_id2 );2649 $this->assertEquals( array( get_category( $category2 ) ), $terms2 );2650 2651 $post_id3 = $this->factory->post->create( array( 'post_title' => 'gamma', 'post_tag' => array( $tag1 ) ) );2652 $post_id4 = $this->factory->post->create( array( 'post_title' => 'delta', 'post_tag' => array( $tag2 ) ) );2653 2654 $query = new WP_Query( array(2655 'fields' => 'ids',2656 'update_post_meta_cache' => false,2657 'update_post_term_cache' => false,2658 'tax_query' => array(2659 //'relation' => 'OR',2660 array(2661 'taxonomy' => 'category',2662 'field' => 'term_id',2663 'terms' => array( $category1, $category2 )2664 )2665 )2666 ) );2667 $ids = $query->get_posts();2668 $this->assertEqualSets( array( $post_id1, $post_id2 ), $ids );2669 }2670 2671 /**2672 2633 * @group taxonomy 2673 2634 */
Note: See TracChangeset
for help on using the changeset viewer.