Changeset 31366 for trunk/tests/phpunit/tests/query.php
- Timestamp:
- 02/07/2015 07:49:17 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/query.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query.php
r30085 r31366 92 92 $this->assertEquals( $query->get_queried_object(), $tag ); 93 93 } 94 95 /** 96 * @ticket 31246 97 */ 98 public function test_get_queried_object_should_return_null_when_is_tax_is_true_but_the_taxonomy_args_have_been_removed_in_a_parse_query_callback() { 99 // Don't override the args provided below. 100 remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) ); 101 register_taxonomy( 'wptests_tax', 'post' ); 102 $terms = $this->factory->term->create_many( 2, array( 103 'taxonomy' => 'wptests_tax', 104 ) ); 105 106 $posts = $this->factory->post->create_many( 2 ); 107 108 wp_set_object_terms( $posts[0], array( $terms[0] ), 'wptests_tax' ); 109 wp_set_object_terms( $posts[1], array( $terms[1] ), 'wptests_tax' ); 110 111 add_action( 'parse_query', array( $this, 'filter_parse_query_to_remove_tax' ) ); 112 $q = new WP_Query( array( 113 'fields' => 'ids', 114 'wptests_tax' => $terms[1], 115 ) ); 116 117 remove_action( 'parse_query', array( $this, 'filter_parse_query_to_remove_tax' ) ); 118 119 $this->assertNull( $q->get_queried_object() ); 120 } 121 122 public function filter_parse_query_to_remove_tax( $q ) { 123 unset( $q->query_vars['wptests_tax'] ); 124 } 94 125 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)