From f5d8814e4e3544a095bba834b341ac3a3a58cab0 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Wed, 16 Oct 2024 06:45:50 -0700 Subject: [PATCH] Add test cases asserting post/term update error exit codes (#513) --- features/post.feature | 10 ++++++++++ features/term.feature | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/features/post.feature b/features/post.feature index e1f4ec34b..b1d9d84e0 100644 --- a/features/post.feature +++ b/features/post.feature @@ -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} diff --git a/features/term.feature b/features/term.feature index 7a9675710..f0440f160 100644 --- a/features/term.feature +++ b/features/term.feature @@ -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