Skip to content

Commit f5d8814

Browse files
Add test cases asserting post/term update error exit codes (#513)
1 parent 50d20fa commit f5d8814

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

features/post.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ Feature: Manage WordPress posts
5757
When I try the previous command again
5858
Then the return code should be 1
5959

60+
Scenario: Updating an invalid post should exit with an error
61+
Given a WP install
62+
63+
When I try `wp post update 22 --post_title=Foo`
64+
Then the return code should be 1
65+
And STDERR should contain:
66+
"""
67+
Warning: Invalid post ID.
68+
"""
69+
6070
Scenario: Setting post categories
6171
When I run `wp term create category "First Category" --porcelain`
6272
And save STDOUT as {TERM_ID}

features/term.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ Feature: Manage WordPress terms
5757
"""
5858
And the return code should be 1
5959

60+
Scenario: Updating an invalid term should exit with an error
61+
Given a WP install
62+
63+
When I try `wp term update category 22 --name=Foo`
64+
Then the return code should be 1
65+
And STDERR should contain:
66+
"""
67+
Error: Term doesn't exist.
68+
"""
69+
6070
Scenario: Creating/deleting a term
6171
When I run `wp term create post_tag 'Test delete term' --slug=test-delete --description='This is a test term to be deleted' --porcelain`
6272
Then STDOUT should be a number

0 commit comments

Comments
 (0)