Changeset 52010 for trunk/tests/phpunit/tests/query.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query.php
r51568 r52010 3 3 class Tests_Query extends WP_UnitTestCase { 4 4 5 function set_up() {5 public function set_up() { 6 6 parent::set_up(); 7 7 … … 13 13 * @ticket 24785 14 14 */ 15 function test_nested_loop_reset_postdata() {15 public function test_nested_loop_reset_postdata() { 16 16 $post_id = self::factory()->post->create(); 17 17 $nested_post_id = self::factory()->post->create(); … … 33 33 * @ticket 16471 34 34 */ 35 function test_default_query_var() {35 public function test_default_query_var() { 36 36 $query = new WP_Query; 37 37 $this->assertSame( '', $query->get( 'nonexistent' ) ); … … 43 43 * @ticket 25380 44 44 */ 45 function test_pre_posts_per_page() {45 public function test_pre_posts_per_page() { 46 46 self::factory()->post->create_many( 10 ); 47 47 … … 53 53 } 54 54 55 function filter_posts_per_page( &$query ) {55 public function filter_posts_per_page( &$query ) { 56 56 $query->set( 'posts_per_rss', 30 ); 57 57 } … … 60 60 * @ticket 26627 61 61 */ 62 function test_tag_queried_object() {62 public function test_tag_queried_object() { 63 63 $slug = 'tag-slug-26627'; 64 64 self::factory()->tag->create( array( 'slug' => $slug ) ); 65 65 $tag = get_term_by( 'slug', $slug, 'post_tag' ); 66 66 67 add_action( 'pre_get_posts', array( $this, ' _tag_queried_object' ), 11 );67 add_action( 'pre_get_posts', array( $this, 'tag_queried_object' ), 11 ); 68 68 69 69 $this->go_to( get_term_link( $tag ) ); … … 76 76 $this->assertEquals( get_queried_object(), $tag ); 77 77 78 remove_action( 'pre_get_posts', array( $this, ' _tag_queried_object' ), 11 );79 } 80 81 function _tag_queried_object( &$query ) {78 remove_action( 'pre_get_posts', array( $this, 'tag_queried_object' ), 11 ); 79 } 80 81 public function tag_queried_object( &$query ) { 82 82 $tag = get_term_by( 'slug', 'tag-slug-26627', 'post_tag' ); 83 83 $this->assertTrue( $query->is_tag() );
Note: See TracChangeset
for help on using the changeset viewer.