wordpress-activitypub/tests/test-class-enable-mastodon-apps.php
Alex Kirk e560d1b5b6
Enable Mastodon Apps: Implement the account endpoint for an external account (#674)
* Implement the account endpoint for an external account

* phpcs

* typos

* Change namespace calling

* Populate with more data

* phpcs

* some formatting

* some phpdoc

* Potentially extend an existing account

props @pfefferle

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>

* phpcs

* Switch to using jsonSerialize

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-01-25 15:54:35 +01:00

23 lines
866 B
PHP

<?php
class Test_Enable_Mastodon_Apps extends WP_UnitTestCase {
public function set_up() {
parent::set_up();
if ( ! class_exists( '\Enable_Mastodon_Apps\Entity\Entity' ) ) {
self::markTestSkipped( 'The Enable_Mastodon_Apps plugin is not active.' );
}
}
public function test_api_account_external() {
$account = apply_filters( 'mastodon_api_account', array(), 'alex@kirk.at' );
$this->assertNotEmpty( $account );
$account = $account->jsonSerialize();
$this->assertArrayHasKey( 'id', $account );
$this->assertArrayHasKey( 'username', $account );
$this->assertArrayHasKey( 'acct', $account );
$this->assertArrayHasKey( 'display_name', $account );
$this->assertArrayHasKey( 'url', $account );
$this->assertEquals( 'https://alex.kirk.at/author/alex/', $account['url'] );
$this->assertEquals( 'Alex Kirk', $account['display_name'] );
}
}