Posts, Post Types: Ensure delete_posts is included in default post type capabilities regardless of map_meta_cap value.

This resolves PHP notices in a few places in core where this capability is checked.

Props Mte90, johnbillion, dipesh.kakadiya, jipmoors, bamadesigner, dd32, johnjamesjacoby, xedin.unknown, flixos90, SergeyBiryukov.
Fixes #30991.

git-svn-id: https://develop.svn.wordpress.org/trunk@47357 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-02-25 12:48:11 +00:00
parent 196859f90f
commit 317e1c076c
2 changed files with 23 additions and 5 deletions

View File

@@ -304,6 +304,24 @@ class Tests_User_MapMetaCap extends WP_UnitTestCase {
);
}
/**
* @ticket 30991
*/
function test_delete_posts_cap_without_map_meta_cap() {
register_post_type(
self::$post_type,
array(
'capability_type' => 'post',
'map_meta_cap' => false,
)
);
$post_type_object = get_post_type_object( self::$post_type );
$this->assertFalse( $post_type_object->map_meta_cap );
$this->assertEquals( 'delete_posts', $post_type_object->cap->delete_posts );
}
function test_unfiltered_html_cap() {
if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
$this->assertFalse( DISALLOW_UNFILTERED_HTML );