Wordpress/tests/phpunit/tests/user
Boone Gorges 829ae5f4ce Fail gracefully when checking mapped cap against unregistered post type.
Post type objects are reponsible for mapping their capabilities to core caps.
As a result, when the post type is no longer registered, the caps are no
longer mapped. This causes problems when a post is left in the database after
the post type is no longer present, and WP does an 'edit_post' or other cap
check against it: a PHP notice is thrown, and the cap check always fails.

As a more graceful fallback, we map all post-type-dependent caps onto
'edit_others_posts', which allows highly privileged users to be able to
access orphaned content (such as comments belonging to disabled post types),
while minimizing the possibility of unintended privilege escalation.

We also add a `_doing_it_wrong()` notice, so that developers and site
administrators are aware that the cap mapping is failing in the absence of
the registered post type.

Props mitchoyoshitaka, DrewAPicture, imath, codeelite, boonebgorges, nofearinc, SergeyBiryukov, jorbin, dlh.
Fixes #16956.

git-svn-id: https://develop.svn.wordpress.org/trunk@34091 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 21:26:57 +00:00
..
author.php Pass post type to count_user_posts() in get_the_author_posts(). 2015-01-08 19:52:52 +00:00
capabilities.php Fail gracefully when checking mapped cap against unregistered post type. 2015-09-12 21:26:57 +00:00
countUserPosts.php Support multiple post types in count_user_posts() and other functions that use get_posts_by_author_sql(). 2015-05-21 18:42:49 +00:00
dateQuery.php Support date_query by user_registered in WP_User_Query. 2014-10-17 01:36:36 +00:00
listAuthors.php Share fixtures across wp_list_authors() tests. 2015-03-08 15:57:02 +00:00
mapMetaCap.php In PHPUnit test classes, parent::tearDown() should be the last thing done in tearDown() methods. 2015-03-05 13:14:15 +00:00
multisite.php Require numeric IDs in user deletion functions. 2015-09-11 02:24:03 +00:00
query.php Avoid returning duplicate matches when using a meta query in WP_User_Query. 2015-06-09 17:41:35 +00:00
session.php Rename the public methods in the session tokens API. 2014-08-27 02:06:53 +00:00
slashes.php Fix typo in a comment in slashing tests. 2015-01-07 07:08:47 +00:00
wpDeleteUser.php Require numeric IDs in user deletion functions. 2015-09-11 02:24:03 +00:00