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:
Scott Taylor
2015-09-14 04:43:48 +00:00
parent 5a6f66faad
commit c16e8b5616
2 changed files with 45 additions and 2 deletions
+10
View File
@@ -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(