2022-03-13 15:54:48 +00:00
< ? 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/>.
// }}}
2022-03-14 18:33:47 +00:00
namespace Plugin\ActivityPub\Test\Objects ;
2022-03-13 15:54:48 +00:00
use App\Entity\Actor ;
2022-03-13 18:11:11 +00:00
use App\Util\GNUsocialTestCase ;
2022-03-13 15:54:48 +00:00
use Plugin\ActivityPub\Entity\ActivitypubActor ;
use Plugin\ActivityPub\Entity\ActivitypubRsa ;
use Plugin\ActivityPub\Util\Explorer ;
2022-03-14 18:33:47 +00:00
class GSActorGroupTest extends GNUsocialTestCase
2022-03-13 15:54:48 +00:00
{
public function testGroupFromJson ()
{
2022-03-14 18:33:47 +00:00
self :: bootKernel ();
$group = Explorer :: getOneFromUri ( 'https://instance.gnusocial.test/actor/21' , try_online : false );
2022-03-13 15:54:48 +00:00
$ap_group = ActivitypubActor :: getByPK ([ 'actor_id' => $group -> getId ()]);
2022-03-14 18:33:47 +00:00
static :: assertSame ( 'https://instance.gnusocial.test/actor/21/inbox.json' , $ap_group -> getInboxUri ());
static :: assertSame ( 'https://instance.gnusocial.test/inbox.json' , $ap_group -> getInboxSharedUri ());
2022-03-13 15:54:48 +00:00
$group = $ap_group -> getActor ();
2022-03-14 18:33:47 +00:00
static :: assertSame ( 'https://instance.gnusocial.test/actor/21' , $group -> getUri ());
2022-03-13 15:54:48 +00:00
static :: assertSame ( Actor :: GROUP , $group -> getType ());
static :: assertSame ( 'hackers' , $group -> getNickname ());
static :: assertSame ( 'Hackers!' , $group -> getFullname ());
$public_key = ActivityPubRsa :: getByActor ( $group ) -> getPublicKey ();
static :: assertSame ( " -----BEGIN PUBLIC KEY----- \n MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoZyKL+GyJbTV/ilVBlzz \n 8OL/UwNi3KpfV5kQwXU0pPcBbw6y2JOfWnKUT1CfiHG3ntiOFnc+wQfHZk4hRSE8 \n 9Xe/G5Y215xW+gqx/kjt2GOENqzSzYXdEZ5Qsx6yumZD/yb6VZK9Og0HjX2mpRs9 \n bactY76w4BQVntjZ17gSkMhYcyPFZTAIe7QDkeSPk5lkXfTwtaB3YcJSbQ3+s7La \n peEgukQDkrLUIP6cxayKrgUl4fhHdpx1Yk4Bzd/1XkZCjeBca94lP1p2M12amI+Z \n OLSTuLyEiCcku8aN+Ms9plwATmIDaGvKFVk0YVtBHdIJlYXV0yIscab3bqyhsLBK \n jwIDAQAB \n -----END PUBLIC KEY----- \n " , $public_key );
}
}