fix the wrongs calld of the get_transformer

This commit is contained in:
André Menrath 2023-11-20 18:27:29 +01:00
parent 38be5865c2
commit 3ae71bb18c
6 changed files with 12 additions and 12 deletions

View file

@ -65,8 +65,8 @@ class Activity_Dispatcher {
return;
}
$transformer = Transformers_Manager::get_transformer( $wp_post );
$transformer->transform( $wp_post );
$transformer = \Activitypub\Transformers_Manager::instance()->get_transformer( $wp_post );
$transformer->set_wp_post( $wp_post );
$transformer->to_object();
$activity = new Activity();
@ -103,8 +103,8 @@ class Activity_Dispatcher {
return;
}
$transformer = Transformers_Manager::get_transformer( $wp_post );
$transformer->transform( $wp_post );
$transformer = \Activitypub\Transformers_Manager::instance()->get_transformer( $wp_post );
$transformer->set_wp_post( $wp_post );
$transformer->to_object();
$activity = new Activity();

View file

@ -168,7 +168,7 @@ class Collection {
);
foreach ( $posts as $post ) {
$response['orderedItems'][] = Transformers_Manager::get_transformer( $post )->transform( $post )->to_object()->to_array();
$response['orderedItems'][] = Transformers_Manager::instance()->get_transformer( $post )->set_wp_post( $wp_post )->to_object()->to_array();
}
$rest_response = new WP_REST_Response( $response, 200 );

View file

@ -105,8 +105,8 @@ class Outbox {
);
foreach ( $posts as $post ) {
$transformer = Transformers_Manager::get_transformer( $wp_post );
$transformer->transform( $wp_post );
$transformer = \Activitypub\Transformers_Manager::instance()->get_transformer( $post );
$transformer->set_wp_post( $wp_post );
$post = $transformer->to_object();
$activity = new Activity();
$activity->set_type( 'Create' );

View file

@ -18,7 +18,7 @@ class Test_Activitypub_Activity extends WP_UnitTestCase {
);
$wp_post = get_post( $post );
$activitypub_post = \Activitypub\Transformers_Manager::get_transforemr( $wp_post )->transform( $wp_post )->to_object();
$activitypub_post = \Activitypub\Transformers_Manager::instance()->get_transformer( $post )->set_wp_post( $wp_post )->to_object();
$activitypub_activity = new \Activitypub\Activity\Activity();
$activitypub_activity->set_type( 'Create' );

View file

@ -10,13 +10,13 @@ class Test_Activitypub_Post extends WP_UnitTestCase {
$permalink = \get_permalink( $post );
$activitypub_post = \Activitypub\Transformers_Manager::get_transformer( get_post( $post ) )->transform( get_post( $post ) )->to_object();
$activitypub_post = \Activitypub\Transformers_Manager::instance()->get_transformer( get_post( $post ) )->set_wp_post( get_post( $post ) )->to_object();
$this->assertEquals( $permalink, $activitypub_post->get_id() );
\wp_trash_post( $post );
$activitypub_post = \Activitypub\Transformers_Manager::get_transformer( get_post( $post ) )->transform( get_post( $post ) )->to_object();
$activitypub_post = \Activitypub\Transformers_Manager::instance()->get_transformer( get_post( $post ) )->set_wp_post( get_post( $post ) )->to_object();
$this->assertEquals( $permalink, $activitypub_post->get_id() );

View file

@ -10,7 +10,7 @@ class Test_Activitypub_Signature_Verification extends WP_UnitTestCase {
)
);
$remote_actor = \get_author_posts_url( 2 );
$activitypub_post = \Activitypub\Transformers_Manager::get_transformer( get_post( $post ) )->transform( get_post( $post ) )->to_object();
$activitypub_post = \Activitypub\Transformers_Manager::instance()->get_transformer( get_post( $post ) )->set_wp_post( get_post( $post ) )->to_object();
$activitypub_activity = new Activitypub\Activity\Activity( 'Create' );
$activitypub_activity->set_type( 'Create' );
$activitypub_activity->set_object( $activitypub_post );
@ -82,7 +82,7 @@ class Test_Activitypub_Signature_Verification extends WP_UnitTestCase {
);
$remote_actor = \get_author_posts_url( 2 );
$remote_actor_inbox = Activitypub\get_rest_url_by_path( '/inbox' );
$activitypub_post = \Activitypub\Transformers_Manager::get_transformer( get_post( $post ) )->transform( get_post( $post ) )->to_object();
$activitypub_post = \Activitypub\Transformers_Manager::instance()->get_transformer( get_post( $post ) )->set_wp_post( get_post( $post ) )->to_object();
$activitypub_activity = new Activitypub\Activity\Activity();
$activitypub_activity->set_type( 'Create' );
$activitypub_activity->set_object( $activitypub_post );