Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add behat test for remove-cap improvement
  • Loading branch information
BhargavBhandari90 committed Apr 9, 2025
commit cde87dde66908de7d178c97c52fce5d459bc39ee
20 changes: 20 additions & 0 deletions features/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,26 @@ Feature: Manage WordPress users
administrator
"""

Scenario: Show error when trying to remove capability same as role
Given a WP install

When I run `wp user create testuser2 [email protected] --first_name=test --last_name=user --role=contributor --porcelain`
Then STDOUT should be a number
And save STDOUT as {USER_ID}

When I run `wp user list-caps {USER_ID}`
Then STDOUT should contain:
"""
contributor
"""

When I run `wp user remove-cap {USER_ID}` contributor
Then the return code should be 1
And STDERR should be:
"""
Error: There is a role similar to 'contributor' capability. Use `wp user remove-role` instead.
"""

Scenario: Managing user capabilities
Given a WP install

Expand Down