fix tests

This commit is contained in:
Matthias Pfefferle 2023-07-20 14:53:34 +02:00
parent 44a81742aa
commit f734e511f7
3 changed files with 21 additions and 6 deletions

View file

@ -39,7 +39,7 @@ class Activity_Dispatcher {
* @return void
*/
public static function send_activity_or_announce( WP_Post $wp_post, $type ) {
if ( is_user_disabled( Users::BLOG_USER_ID ) ) {
if ( is_user_type_disabled( 'blog' ) ) {
return;
}

View file

@ -401,7 +401,7 @@ function is_single_user() {
$return = true;
}
return apply_filters( 'activitypub_is_single_user', $return );
return $return;
}
if ( ! function_exists( 'get_self_link' ) ) {

View file

@ -95,6 +95,13 @@ class Test_Activitypub_Activity_Dispatcher extends ActivityPub_TestCase_Cache_HT
}
public function test_dispatch_announce() {
add_filter(
'activitypub_is_user_type_disabled',
function( $value ) {
return false;
}
);
$followers = array( 'https://example.com/author/jon' );
foreach ( $followers as $follower ) {
@ -131,12 +138,20 @@ class Test_Activitypub_Activity_Dispatcher extends ActivityPub_TestCase_Cache_HT
$followers = array( 'https://example.com/author/jon' );
add_filter(
'activitypub_is_single_user',
function( $return ) {
return true;
}
'activitypub_is_user_type_disabled',
function( $value, $type ) {
if ( 'blog' === $type ) {
return false;
} else {
return true;
}
},
10,
2
);
$this->assertTrue( \Activitypub\is_single_user() );
foreach ( $followers as $follower ) {
\Activitypub\Collection\Followers::add_follower( \Activitypub\Collection\Users::BLOG_USER_ID, $follower );
}