File tree Expand file tree Collapse file tree 2 files changed +4
-30
lines changed
Expand file tree Collapse file tree 2 files changed +4
-30
lines changed Original file line number Diff line number Diff line change @@ -583,27 +583,6 @@ Feature: Manage WordPress comments
583583 Success: Deleted 3 comments.
584584 """
585585
586- Scenario : Delete comments with explicit defer-term-counting flag
587- Given a WP install
588- And I run `wp comment create --comment_post_ID=1 --comment_content='Comment 1' --porcelain`
589- And save STDOUT as {COMMENT_ID_1}
590- And I run `wp comment create --comment_post_ID=1 --comment_content='Comment 2' --porcelain`
591- And save STDOUT as {COMMENT_ID_2}
592-
593- When I run `wp comment delete {COMMENT_ID_1} {COMMENT_ID_2} --defer-term-counting`
594- Then STDOUT should contain:
595- """
596- Success: Trashed comment {COMMENT_ID_1}.
597- """
598- And STDOUT should contain:
599- """
600- Success: Trashed comment {COMMENT_ID_2}.
601- """
602- And STDOUT should contain:
603- """
604- Success: Deleted 2 comments.
605- """
606-
607586 Scenario : Delete comments with mixed success and failure
608587 Given a WP install
609588 And I run `wp comment create --comment_post_ID=1 --comment_content='Comment 1' --porcelain`
Original file line number Diff line number Diff line change @@ -451,15 +451,10 @@ public function delete( $args, $assoc_args ) {
451451 return ;
452452 }
453453
454- $ defer_term_counting = Utils \get_flag_value ( $ assoc_args , 'defer-term-counting ' , false );
455-
456- if ( $ all && ! $ defer_term_counting ) {
457- $ assoc_args ['defer-term-counting ' ] = true ;
458- }
459-
460454 $ status = 0 ;
461455
462- if ( $ defer_term_counting ) {
456+ $ defer_term_counting = wp_defer_comment_counting ();
457+ if ( $ all ) {
463458 wp_defer_term_counting ( true );
464459 }
465460
@@ -485,8 +480,8 @@ public function delete( $args, $assoc_args ) {
485480 }
486481 }
487482
488- if ( $ defer_term_counting ) {
489- wp_defer_term_counting ( false );
483+ if ( $ all ) {
484+ wp_defer_term_counting ( $ defer_term_counting );
490485 }
491486
492487 if ( 0 === $ status ) {
You can’t perform that action at this time.
0 commit comments