LikeTest.php 2.0 KB

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