forked from GNUsocial/gnu-social
36 lines
1.4 KiB
PHP
36 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types = 1);
|
|
|
|
namespace Plugin\ActivityPub\tests;
|
|
|
|
use App\Core\DB\DB;
|
|
use App\Util\GNUsocialTestCase;
|
|
use Plugin\ActivityPub\Util\Model\Activity;
|
|
use Plugin\ActivityPub\Util\Model\Actor;
|
|
use Plugin\ActivityPub\Util\Model\Note;
|
|
|
|
class ActivityPubTestCase extends GNUsocialTestCase
|
|
{
|
|
private static string $fixtures_path = INSTALLDIR . '/plugins/ActivityPub/tests/fixtures';
|
|
|
|
public static function loadFixtures(string $ontology = 'gnusocial'): void
|
|
{
|
|
static::bootKernel();
|
|
// Load Actors
|
|
$person = Actor::fromJson(file_get_contents(self::$fixtures_path . "/{$ontology}/objects/person.jsonld"));
|
|
$group = Actor::fromJson(file_get_contents(self::$fixtures_path . "/{$ontology}/objects/group.jsonld"));
|
|
|
|
// Load Activities
|
|
$create_note = Activity::fromJson(file_get_contents(self::$fixtures_path . "/{$ontology}/activities/create_note.jsonld"));
|
|
$create_page = Activity::fromJson(file_get_contents(self::$fixtures_path . "/{$ontology}/activities/create_page.jsonld"));
|
|
|
|
// Load Objects
|
|
$note = Note::fromJson(file_get_contents(self::$fixtures_path . "/{$ontology}/objects/note.jsonld"));
|
|
$page = Note::fromJson(file_get_contents(self::$fixtures_path . "/{$ontology}/objects/page.jsonld"));
|
|
$reply = Note::fromJson(file_get_contents(self::$fixtures_path . "/{$ontology}/objects/reply.jsonld"));
|
|
|
|
DB::flush();
|
|
}
|
|
}
|