-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebFinger: Add support for URLs (#594)
* add support for URLs * phpcs * simplify vars
- Loading branch information
Showing
4 changed files
with
142 additions
and
23 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
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,43 @@ | ||
<?php | ||
class Test_Activitypub_Users_Collection extends WP_UnitTestCase { | ||
|
||
public function set_up() { | ||
parent::set_up(); | ||
|
||
add_option( 'activitypub_blog_user_identifier', 'blog' ); | ||
add_user_meta( 1, 'activitypub_user_identifier', 'admin' ); | ||
} | ||
/** | ||
* @dataProvider the_resource_provider | ||
*/ | ||
public function test_get_by_various( $resource, $expected ) { | ||
$user = Activitypub\Collection\Users::get_by_resource( $resource ); | ||
|
||
$this->assertInstanceOf( $expected, $user ); | ||
} | ||
|
||
public function the_resource_provider() { | ||
return array( | ||
array( 'http://example.org/?author=1', 'Activitypub\Model\User' ), | ||
array( 'https://example.org/?author=1', 'Activitypub\Model\User' ), | ||
array( 'http://example.org/?author=7', 'WP_Error' ), | ||
array( 'acct:[email protected]', 'Activitypub\Model\User' ), | ||
array( 'acct:[email protected]', 'Activitypub\Model\Blog_User' ), | ||
array( 'acct:*@example.org', 'Activitypub\Model\Blog_User' ), | ||
array( 'acct:[email protected]', 'Activitypub\Model\Blog_User' ), | ||
array( 'acct:[email protected]', 'WP_Error' ), | ||
array( '[email protected]', 'Activitypub\Model\User' ), | ||
array( 'acct:[email protected]', 'Activitypub\Model\Application_User' ), | ||
array( 'http://example.org/@admin', 'Activitypub\Model\User' ), | ||
array( 'http://example.org/@blog', 'Activitypub\Model\Blog_User' ), | ||
array( 'https://example.org/@blog', 'Activitypub\Model\Blog_User' ), | ||
array( 'http://example.org/@blog/', 'Activitypub\Model\Blog_User' ), | ||
array( 'http://example.org/', 'Activitypub\Model\Blog_User' ), | ||
array( 'http://example.org', 'Activitypub\Model\Blog_User' ), | ||
array( 'https://example.org/', 'Activitypub\Model\Blog_User' ), | ||
array( 'https://example.org', 'Activitypub\Model\Blog_User' ), | ||
array( 'http://example.org/@blog/s', 'WP_Error' ), | ||
array( 'http://example.org/@blogs/', 'WP_Error' ), | ||
); | ||
} | ||
} |