fix/adpot unit tests
Some checks are pending
PHP_CodeSniffer / phpcs (push) Waiting to run
Unit Testing / phpunit (5.6, 6.2) (push) Waiting to run
Unit Testing / phpunit (7.0) (push) Waiting to run
Unit Testing / phpunit (7.2) (push) Waiting to run
Unit Testing / phpunit (7.3) (push) Waiting to run
Unit Testing / phpunit (7.4) (push) Waiting to run
Unit Testing / phpunit (8.0) (push) Waiting to run
Unit Testing / phpunit (8.1) (push) Waiting to run
Unit Testing / phpunit (8.2) (push) Waiting to run
Unit Testing / phpunit (latest) (push) Waiting to run

This commit is contained in:
André Menrath 2023-12-29 17:53:32 +01:00
parent f8ad036dbf
commit bf16ba56ec
3 changed files with 8 additions and 24 deletions

View file

@ -135,7 +135,8 @@ class Migration {
if ( $followers ) { if ( $followers ) {
foreach ( $followers as $actor ) { foreach ( $followers as $actor ) {
Followers::add_follower( $user_id, $actor ); $follower_id = Followers::add_follower( $actor );
Followers::add_follow_relationship( $user_id, $follower_id );
} }
} }
} }

View file

@ -364,24 +364,6 @@ class Followers {
'key' => 'activitypub_errors', 'key' => 'activitypub_errors',
'compare' => 'EXISTS', 'compare' => 'EXISTS',
), ),
array(
'key' => 'activitypub_inbox',
'compare' => 'NOT EXISTS',
),
array(
'key' => 'activitypub_actor_json',
'compare' => 'NOT EXISTS',
),
array(
'key' => 'activitypub_inbox',
'value' => '',
'compare' => '=',
),
array(
'key' => 'activitypub_actor_json',
'value' => '',
'compare' => '=',
),
), ),
); );
@ -389,8 +371,10 @@ class Followers {
$items = array(); $items = array();
foreach ( $posts->get_posts() as $follower ) { foreach ( $posts->get_posts() as $follower ) {
if ( ! $follower->filtered_post_content || ! $follower->post_content ) {
$items[] = Follower::init_from_cpt( $follower ); // phpcs:ignore $items[] = Follower::init_from_cpt( $follower ); // phpcs:ignore
} }
}
return $items; return $items;
} }

View file

@ -257,7 +257,7 @@ class Test_Activitypub_Followers extends WP_UnitTestCase {
$follower = \Activitypub\Collection\Followers::get_follower( 1, 'http://sally.example.org' ); $follower = \Activitypub\Collection\Followers::get_follower( 1, 'http://sally.example.org' );
for ( $i = 1; $i <= 15; $i++ ) { for ( $i = 1; $i <= 15; $i++ ) {
add_post_meta( $follower->get__id(), 'activitypub_errors', 'error ' . $i ); add_post_meta( $follower_id, 'activitypub_errors', 'error ' . $i );
} }
$follower = \Activitypub\Collection\Followers::get_follower( 1, 'http://sally.example.org' ); $follower = \Activitypub\Collection\Followers::get_follower( 1, 'http://sally.example.org' );
@ -265,6 +265,7 @@ class Test_Activitypub_Followers extends WP_UnitTestCase {
$followers = \Activitypub\Collection\Followers::get_faulty_followers(); $followers = \Activitypub\Collection\Followers::get_faulty_followers();
$this->assertEquals( 15, $count );
$this->assertEquals( 1, count( $followers ) ); $this->assertEquals( 1, count( $followers ) );
$this->assertEquals( 'http://sally.example.org', $followers[0] ); $this->assertEquals( 'http://sally.example.org', $followers[0] );
@ -408,8 +409,6 @@ class Test_Activitypub_Followers extends WP_UnitTestCase {
$id = $follower->upsert(); $id = $follower->upsert();
echo $id . '\n';
add_post_meta( $id, 'activitypub_user_id', 1 ); add_post_meta( $id, 'activitypub_user_id', 1 );
} }