-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> * phpcs * Switch to using jsonSerialize --------- Co-authored-by: Matthias Pfefferle <[email protected]>
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?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(), '[email protected]' ); | ||
$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'] ); | ||
} | ||
} |