diff options
author | Mario <mario@mariovavti.com> | 2025-07-06 18:32:08 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2025-07-06 18:32:08 +0000 |
commit | 9a3735cd37cfbcd5bc4fefc1282b3cdaf07dc939 (patch) | |
tree | 82896d6d4a6c652aadeff2d3e44df489c8422195 /tests/unit/Lib/ActivityTest.php | |
parent | 222b74ec05fdae22b6c5955ef51455fc208bf23c (diff) | |
download | volse-hubzilla-9a3735cd37cfbcd5bc4fefc1282b3cdaf07dc939.tar.gz volse-hubzilla-9a3735cd37cfbcd5bc4fefc1282b3cdaf07dc939.tar.bz2 volse-hubzilla-9a3735cd37cfbcd5bc4fefc1282b3cdaf07dc939.zip |
tests for Activity::get_actor_protocols()
Diffstat (limited to 'tests/unit/Lib/ActivityTest.php')
-rw-r--r-- | tests/unit/Lib/ActivityTest.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/unit/Lib/ActivityTest.php b/tests/unit/Lib/ActivityTest.php index 46f53ecd9..3b1eaf596 100644 --- a/tests/unit/Lib/ActivityTest.php +++ b/tests/unit/Lib/ActivityTest.php @@ -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'] + ] + ]; + } } |