forked from GNUsocial/gnu-social
55 lines
2.5 KiB
PHP
55 lines
2.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types = 1);
|
|
|
|
// {{{ License
|
|
|
|
// This file is part of GNU social - https://www.gnu.org/software/social
|
|
//
|
|
// GNU social is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// GNU social is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
// }}}
|
|
|
|
namespace Plugin\ActivityPub\tests\Objects;
|
|
|
|
use App\Core\DB\DB;
|
|
use Jchook\AssertThrows\AssertThrows;
|
|
use Plugin\ActivityPub\Entity\ActivitypubRsa;
|
|
use Plugin\ActivityPub\tests\ActivityPubTestCase;
|
|
use Plugin\ActivityPub\Util\Model\Actor;
|
|
|
|
class GSGroupTest extends ActivityPubTestCase
|
|
{
|
|
use AssertThrows;
|
|
|
|
public function testPersonFromJson()
|
|
{
|
|
static::bootKernel();
|
|
static::loadFixtures();
|
|
|
|
$fixtures_path = INSTALLDIR . '/plugins/ActivityPub/tests/fixtures/gnusocial/';
|
|
$person = Actor::fromJson(file_get_contents($fixtures_path . 'objects/group.jsonld'));
|
|
static::assertSame('https://testv3.gnusocial.rocks/actor/2/inbox.json', $person->getInboxUri());
|
|
static::assertSame('https://testv3.gnusocial.rocks/inbox.json', $person->getInboxSharedUri());
|
|
DB::flush();
|
|
$person_actor = $person->getActor();
|
|
static::assertSame('https://testv3.gnusocial.rocks/actor/2', $person_actor->getUri());
|
|
static::assertSame(\App\Entity\Actor::GROUP, $person_actor->getType());
|
|
static::assertSame('hackers', $person_actor->getNickname());
|
|
static::assertSame('Hackers!', $person_actor->getFullname());
|
|
$public_key = ActivityPubRsa::getByActor($person_actor)->getPublicKey();
|
|
static::assertSame("-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoZyKL+GyJbTV/ilVBlzz\n8OL/UwNi3KpfV5kQwXU0pPcBbw6y2JOfWnKUT1CfiHG3ntiOFnc+wQfHZk4hRSE8\n9Xe/G5Y215xW+gqx/kjt2GOENqzSzYXdEZ5Qsx6yumZD/yb6VZK9Og0HjX2mpRs9\nbactY76w4BQVntjZ17gSkMhYcyPFZTAIe7QDkeSPk5lkXfTwtaB3YcJSbQ3+s7La\npeEgukQDkrLUIP6cxayKrgUl4fhHdpx1Yk4Bzd/1XkZCjeBca94lP1p2M12amI+Z\nOLSTuLyEiCcku8aN+Ms9plwATmIDaGvKFVk0YVtBHdIJlYXV0yIscab3bqyhsLBK\njwIDAQAB\n-----END PUBLIC KEY-----\n", $public_key);
|
|
}
|
|
}
|