Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test cases asserting post/term update error exit codes #513

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions features/post.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ Feature: Manage WordPress posts
When I try the previous command again
Then the return code should be 1

Scenario: Updating an invalid post should exit with an error
Given a WP install

When I try `wp post update 22 --post_title=Foo`
Then the return code should be 1
And STDERR should contain:
"""
Warning: Invalid post ID.
"""

Scenario: Setting post categories
When I run `wp term create category "First Category" --porcelain`
And save STDOUT as {TERM_ID}
Expand Down
10 changes: 10 additions & 0 deletions features/term.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ Feature: Manage WordPress terms
"""
And the return code should be 1

Scenario: Updating an invalid term should exit with an error
Given a WP install

When I try `wp term update category 22 --name=Foo`
Then the return code should be 1
And STDERR should contain:
"""
Error: Term doesn't exist.
"""

Scenario: Creating/deleting a term
When I run `wp term create post_tag 'Test delete term' --slug=test-delete --description='This is a test term to be deleted' --porcelain`
Then STDOUT should be a number
Expand Down