From ec143694f75eef4d81ff835f520eee3bfa06997a Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 21 Dec 2015 07:15:33 +0000 Subject: [PATCH] Tests: Prevent role capability pollution in `Tests_Post_GetPostsByAuthorSql::test_user_has_access_only_to_private_posts_for_certain_post_types()`. git-svn-id: https://develop.svn.wordpress.org/trunk@36050 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/post/getPostsByAuthorSql.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/phpunit/tests/post/getPostsByAuthorSql.php b/tests/phpunit/tests/post/getPostsByAuthorSql.php index 6ae81623c2..26de5b8d9f 100644 --- a/tests/phpunit/tests/post/getPostsByAuthorSql.php +++ b/tests/phpunit/tests/post/getPostsByAuthorSql.php @@ -136,6 +136,9 @@ class Tests_Post_GetPostsByAuthorSql extends WP_UnitTestCase { wp_set_current_user( $u ); $maybe_string = get_posts_by_author_sql( array( 'foo', 'bar', 'baz' ) ); + + $editor_role->remove_cap( 'read_private_baz' ); + $this->assertNotContains( "post_type = 'foo' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string ); $this->assertNotContains( "post_type = 'bar' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string ); $this->assertContains( "post_type = 'baz' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string );