Changeset 36484 for trunk/tests/phpunit/tests/query.php
- Timestamp:
- 02/06/2016 03:57:33 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query.php
r36403 r36484 523 523 $this->assertSame( array( $p2 ), $q->posts ); 524 524 } 525 526 /** 527 * @ticket 35619 528 */ 529 public function test_get_queried_object_should_return_first_of_multiple_terms() { 530 register_taxonomy( 'tax1', 'post' ); 531 register_taxonomy( 'tax2', 'post' ); 532 533 $term1 = $this->factory->term->create( array( 'taxonomy' => 'tax1', 'name' => 'term1' ) ); 534 $term2 = $this->factory->term->create( array( 'taxonomy' => 'tax2', 'name' => 'term2' ) ); 535 $post_id = $this->factory->post->create(); 536 wp_set_object_terms( $post_id, 'term1', 'tax1' ); 537 wp_set_object_terms( $post_id, 'term2', 'tax2' ); 538 539 $this->go_to( home_url( '?tax1=term1&tax2=term2' ) ); 540 $queried_object = get_queried_object(); 541 542 $this->assertSame( 'tax1', $queried_object->taxonomy ); 543 $this->assertSame( 'term1', $queried_object->slug ); 544 } 545 546 /** 547 * @ticket 35619 548 */ 549 public function test_query_vars_should_match_first_of_multiple_terms() { 550 register_taxonomy( 'tax1', 'post' ); 551 register_taxonomy( 'tax2', 'post' ); 552 553 $term1 = $this->factory->term->create( array( 'taxonomy' => 'tax1', 'name' => 'term1' ) ); 554 $term2 = $this->factory->term->create( array( 'taxonomy' => 'tax2', 'name' => 'term2' ) ); 555 $post_id = $this->factory->post->create(); 556 wp_set_object_terms( $post_id, 'term1', 'tax1' ); 557 wp_set_object_terms( $post_id, 'term2', 'tax2' ); 558 559 $this->go_to( home_url( '?tax1=term1&tax2=term2' ) ); 560 $queried_object = get_queried_object(); 561 562 $this->assertSame( 'tax1', get_query_var( 'taxonomy' ) ); 563 $this->assertSame( 'term1', get_query_var( 'term' ) ); 564 } 525 565 }
Note: See TracChangeset
for help on using the changeset viewer.