@@ -361,15 +361,15 @@ public function test_update_comment_counts_with_existing_valid_lock() {
361
361
// Set a lock.
362
362
Scheduler::lock ( $ key );
363
363
364
- Scheduler:: async_batch ( $ callback , 10 , 0 );
364
+ \do_action ( ' activitypub_update_comment_counts ' , 10 , 0 );
365
365
366
366
// Verify a scheduled event was created.
367
- $ next_scheduled = wp_next_scheduled ( 'activitypub_async_batch ' , array ( $ callback , 10 , 0 ) );
367
+ $ next_scheduled = wp_next_scheduled ( 'activitypub_update_comment_counts ' , array ( 10 , 0 ) );
368
368
$ this ->assertNotFalse ( $ next_scheduled );
369
369
370
370
// Clean up.
371
371
delete_option ( 'activitypub_migration_lock ' );
372
- wp_clear_scheduled_hook ( 'activitypub_async_batch ' , array ( $ callback , 10 , 0 ) );
372
+ wp_clear_scheduled_hook ( 'activitypub_update_comment_counts ' , array ( 10 , 0 ) );
373
373
}
374
374
375
375
/**
@@ -385,8 +385,10 @@ public function test_async_upgrade() {
385
385
386
386
// Test that lock prevents simultaneous upgrades.
387
387
Scheduler::lock ( $ key );
388
- Scheduler::async_batch ( $ callback );
389
- $ scheduled = \wp_next_scheduled ( 'activitypub_async_batch ' , array ( $ callback ) );
388
+
389
+ \do_action ( 'activitypub_create_post_outbox_items ' , 10 , 0 );
390
+
391
+ $ scheduled = \wp_next_scheduled ( 'activitypub_create_post_outbox_items ' , array ( 10 , 0 ) );
390
392
$ this ->assertNotFalse ( $ scheduled );
391
393
Scheduler::unlock ( $ key );
392
394
@@ -395,15 +397,18 @@ public function test_async_upgrade() {
395
397
\add_action ( 'transition_post_status ' , array ( \Activitypub \Scheduler \Post::class, 'schedule_post_activity ' ), 33 , 3 );
396
398
397
399
// Test scheduling next batch when callback returns more work.
398
- Scheduler:: async_batch ( $ callback , 1 , 0 ); // Small batch size to force multiple batches.
399
- $ scheduled = \wp_next_scheduled ( 'activitypub_async_batch ' , array ( $ callback , 1 , 1 ) );
400
+ \do_action ( ' activitypub_create_post_outbox_items ' , 1 , 0 ); // Small batch size to force multiple batches.
401
+ $ scheduled = \wp_next_scheduled ( 'activitypub_create_post_outbox_items ' , array ( 1 , 1 ) );
400
402
$ this ->assertNotFalse ( $ scheduled );
401
403
402
404
// Test no scheduling when callback returns null (no more work).
403
- Scheduler:: async_batch ( $ callback , 100 , 1000 ); // Large offset to ensure no posts found.
405
+ \do_action ( ' activitypub_create_post_outbox_items ' , 100 , 1000 ); // Large offset to ensure no posts found.
404
406
$ this ->assertFalse (
405
- \wp_next_scheduled ( 'activitypub_async_batch ' , array ( $ callback , 100 , 1100 ) )
407
+ \wp_next_scheduled ( 'activitypub_create_post_outbox_items ' , array ( 100 , 1100 ) )
406
408
);
409
+ }
410
+
411
+ /**
407
412
* Test async_batch method.
408
413
*
409
414
* @covers ::async_batch
0 commit comments