From 46f376e05eb7d52b4a2757f17a0be23f99769bf5 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Thu, 15 Jun 2023 12:24:13 +0200 Subject: [PATCH] fix tests --- includes/model/class-follower.php | 5 ++++- tests/test-class-db-activitypub-followers.php | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/model/class-follower.php b/includes/model/class-follower.php index 9e85cd6..7b41bb0 100644 --- a/includes/model/class-follower.php +++ b/includes/model/class-follower.php @@ -367,7 +367,10 @@ class Follower { * @return void */ public function update() { - $this->updated_at = \time(); + if ( ! $this->updated_at ) { + $this->updated_at = \time(); + } + $this->save(); } diff --git a/tests/test-class-db-activitypub-followers.php b/tests/test-class-db-activitypub-followers.php index a04145a..e660c00 100644 --- a/tests/test-class-db-activitypub-followers.php +++ b/tests/test-class-db-activitypub-followers.php @@ -109,7 +109,8 @@ class Test_Db_Activitypub_Followers extends WP_UnitTestCase { $follower = new \Activitypub\Model\Follower( 'https://example.com/author/jon' ); - update_term_meta( $follower->get_id(), 'updated_at', \time() - 804800 ); + $follower->set_updates_at( \time() - 804800 ); + $follower->update(); $followers = \Activitypub\Collection\Followers::get_outdated_followers(); $this->assertEquals( 1, count( $followers ) ); @@ -129,7 +130,7 @@ class Test_Db_Activitypub_Followers extends WP_UnitTestCase { $follower = new \Activitypub\Model\Follower( 'http://sally.example.org' ); for ( $i = 1; $i <= 15; $i++ ) { - add_term_meta( $follower->get_id(), 'errors', 'error ' . $i ); + add_post_meta( $follower->get_id(), 'errors', 'error ' . $i ); } $follower = new \Activitypub\Model\Follower( 'http://sally.example.org' );