@@ -120,6 +120,8 @@ public function tear_down() {
120120 foreach ( $ outbox_items as $ item_id ) {
121121 \wp_delete_post ( $ item_id , true );
122122 }
123+
124+ parent ::tear_down ();
123125 }
124126
125127 /**
@@ -594,20 +596,16 @@ public function test_update_comment_author_emails() {
594596 */
595597 public function test_update_comment_author_emails_batching () {
596598 // Create multiple comments.
597- $ comment_ids = array ();
598- for ( $ i = 0 ; $ i < 3 ; $ i ++ ) {
599- $ comment_ids [] = self ::factory ()->comment ->create (
600- array (
601- 'comment_post_ID ' => self ::$ fixtures ['posts ' ][0 ],
602- 'comment_author ' => "Test User $ i " ,
603- 'comment_author_url ' => "https://example.com/users/test $ i " ,
604- 'comment_author_email ' => '' ,
605- 'comment_content ' => "Test comment $ i " ,
606- 'comment_type ' => 'comment ' ,
607- 'comment_meta ' => array ( 'protocol ' => 'activitypub ' ),
608- )
609- );
610- }
599+ // Note: We rely on comment_ID ordering (added to migration function) for deterministic batching.
600+ $ comment_ids = self ::factory ()->comment ->create_many (
601+ 3 ,
602+ array (
603+ 'comment_post_ID ' => self ::$ fixtures ['posts ' ][0 ],
604+ 'comment_author_email ' => '' ,
605+ 'comment_type ' => 'comment ' ,
606+ 'comment_meta ' => array ( 'protocol ' => 'activitypub ' ),
607+ )
608+ );
611609
612610 // Mock the HTTP request.
613611 \add_filter ( 'pre_http_request ' , array ( $ this , 'mock_webfinger ' ) );
@@ -630,11 +628,8 @@ public function test_update_comment_author_emails_batching() {
630628 foreach ( $ comment_ids as $ comment_id ) {
631629 $ comment = \get_comment ( $ comment_id );
632630 $ this ->
assertEquals (
'[email protected] ' ,
$ comment->
comment_author_email );
633-
634- wp_delete_comment ( $ comment_id , true );
635631 }
636632
637- _delete_all_data ();
638633 \remove_filter ( 'pre_http_request ' , array ( $ this , 'mock_webfinger ' ) );
639634 }
640635
0 commit comments