Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 4 years ago

#32394 closed enhancement (fixed)

Tests_User_Capabilities should test all capabilities for each role

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 4.3 Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords: good-first-bug has-patch
Focuses: Cc:


The Tests_User_Capabilities unit test class only tests a sampling of capabilities for each role in the test_user_{role}() methods.

These methods should have complete coverage of all capabilities for each role.

Attachments (1)

ticket-32394.patch (9.5 KB) - added by anubisthejackle 9 years ago.
Add all capabilities from Codex.

Download all attachments as: .zip

Change History (17)

#1 @johnbillion
9 years ago

Note that all existing capabilities should be tested for all roles, with assertTrue() and assertFalse() used accordingly.

9 years ago

Add all capabilities from Codex.

#2 @anubisthejackle
9 years ago

  • Keywords has-patch added

Patch added. Adds capabilities listed in the codex page. Tests for both true and false where applicable.

#3 @johnbillion
9 years ago

  • Owner set to johnbillion
  • Status changed from new to accepted

Thanks for the patch, anubisthejackle!

I think this can be made a little clearer, and it needs support for the differing capabilities when multisite is enabled too. I have an updated patch which I'll attach shortly.

#4 @johnbillion
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 32812:

Comprehensive unit tests for every available capability, and for all roles.

Fixes #32394.

#5 @johnbillion
9 years ago

  • Keywords needs-unit-tests removed
  • Milestone changed from Awaiting Review to 4.3

#6 @johnbillion
9 years ago

In 34449:

Correct a capability name in the roles and capabilities mapping. The delete_others_pages key was missing, and the delete_others_posts key was duplicated.

Introduced in [32812].

See #32394.

#7 @johnbillion
9 years ago

In 34450:

Add tests for some missing capabilities, including do_not_allow.

See #32394.

#8 @johnbillion
8 years ago

In 36047:

Tests: Shave a second off the user capability tests by reusing its user fixtures.

See #30017, #32394

#9 @johnbillion
8 years ago

In 36049:

Tests: Fix all the things.

See #30017, #32394

#10 @johnbillion
8 years ago

In 37157:

Role/Capability: Add create_sites and delete_sites to the list of capabilities that are checked as part of the comporehensive roles and capabilities tests.

See #32394, #36413

#11 @johnbillion
8 years ago

In 38482:

Role/Capability: Add two missing meta capabilities to the caps tests.

See #32394

#12 @johnbillion
8 years ago

In 38521:

Role/Capability: Split meta and primitive capabilities in the helper functions in the roles and capability tests so primitive capability tests can be made more accurate.

See #35614
See #32394

#13 @johnbillion
8 years ago

In 38522:

Role/Capability: Correct the multisite cap tests after [38521].

See #35614
See #32394

#14 @johnbillion
8 years ago

  • Component changed from Users to Role/Capability

#15 @johnbillion
4 years ago

In 49604:

Build/Test Tools: Ensure user capability assertions are performed for all default roles.

The existing assertions were erroneously placed outside the iteration of all users, and therefore were only run against the last user in the list, which is the Subscriber role.

See #51344, #32394

#16 @johnbillion
4 years ago

In 49605:

Built/Test Tools: Switch to a data provider for the default user role and capability tests.

This test previously performed 1,010 assertions, and a failure in any one would prevent the other assertions from running. Using a data provider means simultaneous failures will all be reported at once.

See #51344, #32394

Note: See TracTickets for help on using tickets.