Support multiple post types in count_user_posts() and other functions that use get_posts_by_author_sql().

Props nikonratm.
Fixes #32243.

git-svn-id: https://develop.svn.wordpress.org/trunk@32523 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-05-21 18:42:49 +00:00
parent 6d1e0f0704
commit e656053bce
4 changed files with 119 additions and 53 deletions

View File

@@ -78,4 +78,18 @@ class Tests_User_CountUserPosts extends WP_UnitTestCase {
public function test_count_user_posts_post_type_cpt() {
$this->assertEquals( 3, count_user_posts( self::$user_id, 'wptests_pt' ) );
}
/**
* @ticket 32243
*/
public function test_count_user_posts_with_multiple_post_types() {
$this->assertEquals( 7, count_user_posts( self::$user_id, array( 'wptests_pt', 'post' ) ) );
}
/**
* @ticket 32243
*/
public function test_count_user_posts_should_ignore_non_existent_post_types() {
$this->assertEquals( 4, count_user_posts( self::$user_id, array( 'foo', 'post' ) ) );
}
}