Skip to content
Open
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
17 changes: 17 additions & 0 deletions features/post.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ Feature: Manage WordPress posts
When I try the previous command again
Then the return code should be 1

Scenario: Deleting already trashed custom post type posts
When I run `wp post create --post_title='Test CPT post' --post_type='book' --porcelain`
Then STDOUT should be a number
And save STDOUT as {BOOK_POST_ID}

When I run `wp post update {BOOK_POST_ID} --post_status='trash'`
Then STDOUT should be:
"""
Success: Updated post {BOOK_POST_ID}.
"""

When I run `wp post delete {BOOK_POST_ID}`
Then STDOUT should be:
"""
Success: Deleted post {BOOK_POST_ID}.
"""

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

Expand Down
1 change: 1 addition & 0 deletions src/Post_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ protected function delete_callback( $post_id, $assoc_args ) {
$post_type = get_post_type( $post_id );

if ( ! $assoc_args['force']
&& 'trash' !== $status
&& ( 'post' !== $post_type && 'page' !== $post_type ) ) {
return [
'error',
Expand Down
Loading