LikeTest.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Tests\Unit\ActivityPub\Verb;
  3. use App\Util\ActivityPub\Validator\Like;
  4. use PHPUnit\Framework\Attributes\Test;
  5. use Tests\TestCase;
  6. class LikeTest extends TestCase
  7. {
  8. protected array $basicLike;
  9. public function setUp(): void
  10. {
  11. parent::setUp();
  12. $this->basicLike = [
  13. 'type' => 'Like',
  14. 'signature' => [
  15. 'type' => 'RsaSignature2017',
  16. 'signatureValue' => 'fdxMfQSMwbC6wP6sh6neS/vM5879K67yQkHTbiT5Npr5wAac0y6+o3Ij+41tN3rL6wfuGTosSBTHOtta6R4GCOOhCaCSLMZKypnp1VltCzLDoyrZELnYQIC8gpUXVmIycZbREk22qWUe/w7DAFaKK4UscBlHDzeDVcA0K3Se5Sluqi9/Zh+ldAnEzj/rSEPDjrtvf5wGNf3fHxbKSRKFt90JvKK6hS+vxKUhlRFDf6/SMETw+EhwJSNW4d10yMUakqUWsFv4Acq5LW7l+HpYMvlYY1FZhNde1+uonnCyuQDyvzkff8zwtEJmAXC4RivO/VVLa17SmqheJZfI8oluVg==',
  17. 'creator' => 'http://mastodon.example.org/users/admin#main-key',
  18. 'created' => '2018-02-17T18:57:49Z',
  19. ],
  20. 'object' => 'http://pixelfed.dev/p/1',
  21. 'nickname' => 'dsup',
  22. 'id' => 'http://mastodon.example.org/users/admin#likes/2',
  23. 'actor' => 'http://mastodon.example.org/users/admin',
  24. '@context' => [
  25. 'https://www.w3.org/ns/activitystreams',
  26. 'https://w3id.org/security/v1',
  27. [
  28. 'toot' => 'http://joinmastodon.org/ns#',
  29. 'sensitive' => 'as:sensitive',
  30. 'ostatus' => 'http://ostatus.org#',
  31. 'movedTo' => 'as:movedTo',
  32. 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
  33. 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri',
  34. 'conversation' => 'ostatus:conversation',
  35. 'atomUri' => 'ostatus:atomUri',
  36. 'Hashtag' => 'as:Hashtag',
  37. 'Emoji' => 'toot:Emoji',
  38. ],
  39. ],
  40. ];
  41. }
  42. #[Test]
  43. public function basic_like()
  44. {
  45. $this->assertTrue(Like::validate($this->basicLike));
  46. }
  47. }