Changeset 25554 for trunk/tests/phpunit/tests/post.php
- Timestamp:
- 09/21/2013 05:54:36 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post.php
r25265 r25554 809 809 } 810 810 811 function test_wp_count_posts_filtered() { 812 $post_type = rand_str(20); 813 register_post_type( $post_type ); 814 $this->factory->post->create_many( 10, array( 815 'post_type' => $post_type, 816 'post_author' => $this->author_id 817 ) ); 818 $count1 = wp_count_posts( $post_type, 'readable' ); 819 $this->assertEquals( 10, $count1->publish ); 820 add_filter( 'count_posts', array( $this, 'filter_wp_count_posts' ) ); 821 822 $count2 = wp_count_posts( $post_type, 'readable' ); 823 $this->assertEquals( 7, $count2->publish ); 824 825 remove_filter( 'count_posts', array( $this, 'filter_wp_count_posts' ) ); 826 } 827 828 function filter_wp_count_posts( $counts ) { 829 $counts->publish = 7; 830 return $counts; 831 } 832 811 833 /** 812 834 * @ticket 22074
Note: See TracChangeset
for help on using the changeset viewer.