444c4b2837
* fix #463 * fix delete /cc #465 @janboddez * add disclaimer to not use the same name as an author login see #470 * check if url is cached before trashing it
27 lines
739 B
PHP
27 lines
739 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\Post::transform( get_post( $post ) )->to_object();
|
|
|
|
$this->assertEquals( $permalink, $activitypub_post->get_id() );
|
|
|
|
\wp_trash_post( $post );
|
|
|
|
$activitypub_post = \Activitypub\Transformer\Post::transform( get_post( $post ) )->to_object();
|
|
|
|
$this->assertEquals( $permalink, $activitypub_post->get_id() );
|
|
|
|
$cached = \get_post_meta( $post, 'activitypub_canonical_url', true );
|
|
|
|
$this->assertEquals( $cached, $activitypub_post->get_id() );
|
|
}
|
|
}
|