3 namespace Friendica\Test\Protocol;
5 use Friendica\Protocol\Activity;
6 use Friendica\Protocol\ActivityNamespace;
7 use Friendica\Test\MockedTest;
9 class ActivityTest extends MockedTest
11 public function dataMatch()
20 'haystack' => Activity\ObjectType::TAGTERM,
21 'needle' => Activity\ObjectType::TAGTERM,
25 'haystack' => 'tagterm',
26 'needle' => ActivityNamespace::ACTIVITY_SCHEMA . Activity\ObjectType::TAGTERM,
30 'haystack' => 'tagterm',
34 'invalidWithOutNamespace' => [
35 'haystack' => 'tagterm',
36 'needle' => Activity\ObjectType::TAGTERM,
40 'haystack' => 'tagterm',
41 'needle' => ActivityNamespace::ACTIVITY_SCHEMA . '/bla/' . Activity\ObjectType::TAGTERM,
48 * Test the different, possible matchings
50 * @dataProvider dataMatch
52 public function testMatch(string $haystack, string $needle, bool $assert)
54 $activity = new Activity();
56 $this->assertEquals($assert, $activity->match($haystack, $needle));
59 public function testIsHidden()
61 $activity = new Activity();
63 $this->assertTrue($activity->isHidden(Activity::LIKE));
64 $this->assertFalse($activity->isHidden(Activity\ObjectType::BOOKMARK));