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/>.
// }}}
namespace Plugin\ActivityPub\tests\Objects ;
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-13 18:11:11 +00:00
class GSGroupTest extends GNUsocialTestCase
2022-03-13 15:54:48 +00:00
{
public function testGroupFromJson ()
{
$group = Explorer :: getOneFromUri ( 'https://testv3.gnusocial.rocks/actor/21' , try_online : false );
$ap_group = ActivitypubActor :: getByPK ([ 'actor_id' => $group -> getId ()]);
static :: assertSame ( 'https://testv3.gnusocial.rocks/actor/21/inbox.json' , $ap_group -> getInboxUri ());
static :: assertSame ( 'https://testv3.gnusocial.rocks/inbox.json' , $ap_group -> getInboxSharedUri ());
$group = $ap_group -> getActor ();
static :: assertSame ( 'https://testv3.gnusocial.rocks/actor/21' , $group -> getUri ());
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 );
}
}