WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#32394 closed enhancement (fixed)

Tests_User_Capabilities should test all capabilities for each role

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

Description

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 4 years ago.
Add all capabilities from Codex.

Download all attachments as: .zip

Change History (15)

#1 @johnbillion
4 years ago

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

@anubisthejackle
4 years ago

Add all capabilities from Codex.

#2 @anubisthejackle
4 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
4 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
4 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
4 years ago

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

#6 @johnbillion
4 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
4 years ago

In 34450:

Add tests for some missing capabilities, including do_not_allow.

See #32394.

#8 @johnbillion
4 years ago

In 36047:

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

See #30017, #32394

#9 @johnbillion
4 years ago

In 36049:

Tests: Fix all the things.

See #30017, #32394

#10 @johnbillion
4 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
3 years ago

In 38482:

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

See #32394

#12 @johnbillion
3 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
3 years ago

In 38522:

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

See #35614
See #32394

#14 @johnbillion
3 years ago

  • Component changed from Users to Role/Capability
Note: See TracTickets for help on using tickets.