mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
tests for Activity::get_actor_protocols()
This commit is contained in:
@@ -281,4 +281,41 @@ class ActivityTest extends UnitTestCase {
|
||||
$this->assertArrayHasKey('aKey', $packet);
|
||||
$this->assertEquals('aValue', $packet['aKey']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get protocols from an activitystreams actor object
|
||||
*
|
||||
* @dataProvider get_actor_protocols_provider
|
||||
*/
|
||||
public function test_get_actor_protocols(array $actor, array $expected): void {
|
||||
$this->assertEquals($expected, Activity::get_actor_protocols($actor));
|
||||
}
|
||||
|
||||
/**
|
||||
* Dataprovider for test_get_actor_protocols.
|
||||
*/
|
||||
public static function get_actor_protocols_provider(): array {
|
||||
return [
|
||||
'none' => [
|
||||
['tag' => ['type' => 'Note', 'name' => 'Website', 'content' => 'https://example.com']],
|
||||
[]
|
||||
],
|
||||
'legacy' => [
|
||||
['tag' =>
|
||||
['type' => 'PropertyValue', 'name' => 'Protocol', 'value' => 'zot6'],
|
||||
['type' => 'PropertyValue', 'name' => 'Protocol', 'value' => 'activitypub'],
|
||||
['type' => 'PropertyValue', 'name' => 'Protocol', 'value' => 'diaspora']
|
||||
],
|
||||
['zot6', 'activitypub', 'diaspora']
|
||||
],
|
||||
'fep-fb2a' => [
|
||||
['tag' => ['type' => 'Note', 'name' => 'Protocols', 'content' => 'zot6,activitypub,diaspora']],
|
||||
['zot6', 'activitypub', 'diaspora']
|
||||
],
|
||||
'fep-fb2a with spaces' => [
|
||||
['tag' => ['type' => 'Note', 'name' => 'Protocols', 'content' => 'zot6, activitypub, diaspora']],
|
||||
['zot6', 'activitypub', 'diaspora']
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user