@@ -284,13 +284,16 @@ function ( $message, $meta, $object_id, $context_type, $action, $user_id ) use (
284284 }
285285 );
286286
287- $ stream_connector ->callback_activitypub_handled_follow ( $ activity , self ::$ user_id , true , $ context );
287+ // The "activitypub_handled_follow" hook fires with an array of user IDs (int[]).
288+ $ stream_connector ->callback_activitypub_handled_follow ( $ activity , array ( self ::$ user_id ), true , $ context );
288289
289290 $ this ->assertNotNull ( $ logged_data , 'Should have logged the follow event ' );
290291 $ this ->assertStringContainsString ( 'New Follower: https://example.com/actor ' , $ logged_data ['message ' ] );
291292 $ this ->assertEquals ( 'notification ' , $ logged_data ['context_type ' ] );
292293 $ this ->assertEquals ( 'follow ' , $ logged_data ['action ' ] );
293- $ this ->assertEquals ( self ::$ user_id , $ logged_data ['user_id ' ] );
294+ // Stream's log() builds a WP_User from this value, so it must be a single integer, not the array.
295+ $ this ->assertIsInt ( $ logged_data ['user_id ' ], 'Stream log() must receive a single integer user ID, not an array. ' );
296+ $ this ->assertSame ( self ::$ user_id , $ logged_data ['user_id ' ] );
294297 $ this ->assertArrayHasKey ( 'activity ' , $ logged_data ['meta ' ] );
295298 $ this ->assertArrayHasKey ( 'remote_actor ' , $ logged_data ['meta ' ] );
296299 }
@@ -327,7 +330,8 @@ function ( $message, $meta ) use ( &$logged_data ) {
327330 }
328331 );
329332
330- $ stream_connector ->callback_activitypub_handled_follow ( $ activity , self ::$ user_id , false , $ context );
333+ // The "activitypub_handled_follow" hook fires with an array of user IDs (int[]).
334+ $ stream_connector ->callback_activitypub_handled_follow ( $ activity , array ( self ::$ user_id ), false , $ context );
331335
332336 $ this ->assertStringContainsString ( 'New Follower: https://example.com/actor ' , $ logged_data ['message ' ] );
333337 }
0 commit comments