File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -555,6 +555,33 @@ Feature: Manage WordPress comments
555555 Success: No comments deleted.
556556 """
557557
558+ Scenario : Delete multiple comments shows summary message
559+ Given a WP install
560+ And I run `wp comment create --comment_post_ID=1 --comment_content='Comment 1' --porcelain`
561+ And save STDOUT as {COMMENT_ID_1}
562+ And I run `wp comment create --comment_post_ID=1 --comment_content='Comment 2' --porcelain`
563+ And save STDOUT as {COMMENT_ID_2}
564+ And I run `wp comment create --comment_post_ID=1 --comment_content='Comment 3' --porcelain`
565+ And save STDOUT as {COMMENT_ID_3}
566+
567+ When I run `wp comment delete {COMMENT_ID_1} {COMMENT_ID_2} {COMMENT_ID_3}`
568+ Then STDOUT should contain:
569+ """
570+ Success: Trashed comment {COMMENT_ID_1}.
571+ """
572+ And STDOUT should contain:
573+ """
574+ Success: Trashed comment {COMMENT_ID_2}.
575+ """
576+ And STDOUT should contain:
577+ """
578+ Success: Trashed comment {COMMENT_ID_3}.
579+ """
580+ And STDOUT should contain:
581+ """
582+ Success: Deleted 3 comments.
583+ """
584+
558585 Scenario : Error when no comment IDs and no --all flag provided
559586 Given a WP install
560587
Original file line number Diff line number Diff line change @@ -490,7 +490,9 @@ public function delete( $args, $assoc_args ) {
490490 }
491491
492492 if ( 0 === $ status ) {
493- WP_CLI ::success ( "Deleted {$ successfully_deleted } comments. " );
493+ if ( $ total > 1 ) {
494+ WP_CLI ::success ( "Deleted {$ successfully_deleted } comments. " );
495+ }
494496 } else {
495497 $ error_count = $ total - $ successfully_deleted ;
496498 WP_CLI ::error ( "Failed deleting {$ error_count } comments. " );
You can’t perform that action at this time.
0 commit comments