mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 23:58:03 +00:00
Add sanity checks in map_meta_cap(), return 'do_not_allow' when posts don't exist.
Adds unit test. Props ocean90, nerrad, filosofo. Fixes #23162. git-svn-id: https://develop.svn.wordpress.org/trunk@34113 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -37,6 +37,16 @@ class Tests_User_MapMetaCap extends WP_UnitTestCase {
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 13905
|
||||
*/
|
||||
function test_capability_type_post_with_invalid_id() {
|
||||
$this->assertEquals(
|
||||
array( 'do_not_allow' ),
|
||||
map_meta_cap( 'edit_post', $this->user_id, $this->post_id + 1 )
|
||||
);
|
||||
}
|
||||
|
||||
function test_capability_type_post_with_no_extra_caps() {
|
||||
|
||||
register_post_type( $this->post_type, array(
|
||||
|
||||
Reference in New Issue
Block a user