Skip to content

Commit

Permalink
Add test cases asserting post/term update error exit codes (#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored Oct 16, 2024
1 parent 50d20fa commit f5d8814
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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

0 comments on commit f5d8814

Please sign in to comment.