Skip to content

Commit

Permalink
Issue wp-cli#356 : Add behat test for new command
Browse files Browse the repository at this point in the history
  • Loading branch information
buntybuddyboss committed Aug 28, 2022
1 parent 6c4fd74 commit 7b40d8c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions features/post-meta.feature
Original file line number Diff line number Diff line change
Expand Up @@ -488,3 +488,46 @@ Feature: Manage post custom fields
"""
[ "new", "bar" ]
"""
Scenario: Clean up duplicate post meta values.
Given a WP install
And a session_no file:
"""
n
"""
And a session_yes file:
"""
y
"""
When I run `wp post meta add 1 foo bar`
Then STDOUT should be:
"""
Success: Added custom field.
"""
When I try the previous command again
Then the return code should be 0
When I try the previous command again
Then the return code should be 0
When I run `wp post meta clean-duplicates 1 foo < session_no`
# Check for contains only, as the string contains a trailing space.
Then STDOUT should contain:
"""
Are you sure you want to delete 2 duplicate enclosures and keep 1 valid enclosures? [y/n]
"""
When I run `wp post meta clean-duplicates 1 foo < session_yes`
Then STDOUT should contain:
"""
Success: Cleaned up duplicate enclosures.
"""
When I run `wp post meta clean-duplicates 1 food`
Then STDERR should contain:
"""
Error: No enclosures found.
"""
And the return code should be 1

0 comments on commit 7b40d8c

Please sign in to comment.