fix tests

This commit is contained in:
Matthias Pfefferle 2023-06-15 12:24:13 +02:00
parent 37c61fbf07
commit 46f376e05e
2 changed files with 7 additions and 3 deletions

View file

@ -367,7 +367,10 @@ class Follower {
* @return void * @return void
*/ */
public function update() { public function update() {
if ( ! $this->updated_at ) {
$this->updated_at = \time(); $this->updated_at = \time();
}
$this->save(); $this->save();
} }

View file

@ -109,7 +109,8 @@ class Test_Db_Activitypub_Followers extends WP_UnitTestCase {
$follower = new \Activitypub\Model\Follower( 'https://example.com/author/jon' ); $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(); $followers = \Activitypub\Collection\Followers::get_outdated_followers();
$this->assertEquals( 1, count( $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' ); $follower = new \Activitypub\Model\Follower( 'http://sally.example.org' );
for ( $i = 1; $i <= 15; $i++ ) { 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' ); $follower = new \Activitypub\Model\Follower( 'http://sally.example.org' );