wordpress-activitypub/tests/test-class-activitypub-post.php
André Menrath 225e06dfec
Some checks failed
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
PHP_CodeSniffer / phpcs (push) Failing after 4m3s
Unit Testing / phpunit (5.6, 6.2) (push) Failing after 4m36s
Unit Testing / phpunit (7.0) (push) Has been cancelled
rename Transformers_Mangaer to Transformer_Factory
2023-11-30 08:36:05 +01:00

27 lines
767 B
PHP

<?php
class Test_Activitypub_Post extends WP_UnitTestCase {
public function test_to_array() {
$post = \wp_insert_post(
array(
'post_author' => 1,
'post_content' => 'test',
)
);
$permalink = \get_permalink( $post );
$activitypub_post = \Activitypub\Transformer\Transformer_Factory::instance()->transform( get_post( $post ) );
$this->assertEquals( $permalink, $activitypub_post->get_id() );
\wp_trash_post( $post );
$activitypub_post = \Activitypub\Transformer\Transformer_Factory::instance()->transform( get_post( $post ) );
$this->assertEquals( $permalink, $activitypub_post->get_id() );
$cached = \get_post_meta( $post, 'activitypub_canonical_url', true );
$this->assertEquals( $cached, $activitypub_post->get_id() );
}
}