FollowTest.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace Tests\Unit\ActivityPub\Verb;
  3. use App\Util\ActivityPub\Validator\Follow;
  4. use Tests\TestCase;
  5. class FollowTest extends TestCase
  6. {
  7. protected array $basicFollow;
  8. public function setUp(): void
  9. {
  10. parent::setUp();
  11. $this->basicFollow = [
  12. 'type' => 'Follow',
  13. 'signature' => [
  14. 'type' => 'RsaSignature2017',
  15. 'signatureValue' => 'Kn1/UkAQGJVaXBfWLAHcnwHg8YMAUqlEaBuYLazAG+pz5hqivsyrBmPV186Xzr+B4ZLExA9+SnOoNx/GOz4hBm0kAmukNSILAsUd84tcJ2yT9zc1RKtembK4WiwOw7li0+maeDN0HaB6t+6eTqsCWmtiZpprhXD8V1GGT8yG7X24fQ9oFGn+ng7lasbcCC0988Y1eGqNe7KryxcPuQz57YkDapvtONzk8gyLTkZMV4De93MyRHq6GVjQVIgtiYabQAxrX6Q8C+4P/jQoqdWJHEe+MY5JKyNaT/hMPt2Md1ok9fZQBGHlErk22/zy8bSN19GdG09HmIysBUHRYpBLig==',
  16. 'creator' => 'http://mastodon.example.org/users/admin#main-key',
  17. 'created' => '2018-02-17T13:29:31Z',
  18. ],
  19. 'object' => 'http://pixelfed.dev/users/dsup',
  20. 'nickname' => 'dsup',
  21. 'id' => 'http://mastodon.example.org/users/admin#follows/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_follow()
  43. {
  44. $this->assertTrue(Follow::validate($this->basicFollow));
  45. }
  46. }