[PLUGIN][ActivityPub][TESTS] Move ActivityPub test fixtures to new facility
This commit is contained in:
parent
1d8bba3949
commit
cbae649991
@ -24,12 +24,12 @@ declare(strict_types = 1);
|
|||||||
namespace Plugin\ActivityPub\tests\Objects;
|
namespace Plugin\ActivityPub\tests\Objects;
|
||||||
|
|
||||||
use App\Entity\Actor;
|
use App\Entity\Actor;
|
||||||
|
use App\Util\GNUsocialTestCase;
|
||||||
use Plugin\ActivityPub\Entity\ActivitypubActor;
|
use Plugin\ActivityPub\Entity\ActivitypubActor;
|
||||||
use Plugin\ActivityPub\Entity\ActivitypubRsa;
|
use Plugin\ActivityPub\Entity\ActivitypubRsa;
|
||||||
use Plugin\ActivityPub\tests\ActivityPubTestCase;
|
|
||||||
use Plugin\ActivityPub\Util\Explorer;
|
use Plugin\ActivityPub\Util\Explorer;
|
||||||
|
|
||||||
class GSGroupTest extends ActivityPubTestCase
|
class GSGroupTest extends GNUsocialTestCase
|
||||||
{
|
{
|
||||||
public function testGroupFromJson()
|
public function testGroupFromJson()
|
||||||
{
|
{
|
||||||
|
@ -24,12 +24,12 @@ declare(strict_types = 1);
|
|||||||
namespace Plugin\ActivityPub\tests\Objects;
|
namespace Plugin\ActivityPub\tests\Objects;
|
||||||
|
|
||||||
use App\Entity\Actor;
|
use App\Entity\Actor;
|
||||||
|
use App\Util\GNUsocialTestCase;
|
||||||
use Plugin\ActivityPub\Entity\ActivitypubActor;
|
use Plugin\ActivityPub\Entity\ActivitypubActor;
|
||||||
use Plugin\ActivityPub\Entity\ActivitypubRsa;
|
use Plugin\ActivityPub\Entity\ActivitypubRsa;
|
||||||
use Plugin\ActivityPub\tests\ActivityPubTestCase;
|
|
||||||
use Plugin\ActivityPub\Util\Explorer;
|
use Plugin\ActivityPub\Util\Explorer;
|
||||||
|
|
||||||
class GSPersonTest extends ActivityPubTestCase
|
class GSPersonTest extends GNUsocialTestCase
|
||||||
{
|
{
|
||||||
public function testPersonFromJson()
|
public function testPersonFromJson()
|
||||||
{
|
{
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
declare(strict_types = 1);
|
declare(strict_types = 1);
|
||||||
|
|
||||||
namespace Plugin\ActivityPub\tests;
|
namespace Plugin\ActivityPub\Test\Fixtures;
|
||||||
|
|
||||||
use App\Core\DB\DB;
|
use App\Core\DB\DB;
|
||||||
use App\Util\GNUsocialTestCase;
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
use Plugin\ActivityPub\Util\Model\Activity;
|
use Plugin\ActivityPub\Util\Model\Activity;
|
||||||
use Plugin\ActivityPub\Util\Model\Actor;
|
use Plugin\ActivityPub\Util\Model\Actor;
|
||||||
use Plugin\ActivityPub\Util\Model\Note;
|
use Plugin\ActivityPub\Util\Model\Note;
|
||||||
|
|
||||||
class ActivityPubTestCase extends GNUsocialTestCase
|
class ActivityPubFixtures extends Fixture
|
||||||
{
|
{
|
||||||
private static bool $loaded_fixtures = false;
|
|
||||||
private static string $fixtures_path = INSTALLDIR . '/plugins/ActivityPub/tests/fixtures';
|
private static string $fixtures_path = INSTALLDIR . '/plugins/ActivityPub/tests/fixtures';
|
||||||
|
|
||||||
public static function fixturesPath(string $path, string $ontology = 'gnusocial'): string
|
public static function fixturesPath(string $path, string $ontology = 'gnusocial'): string
|
||||||
@ -20,21 +20,13 @@ class ActivityPubTestCase extends GNUsocialTestCase
|
|||||||
return self::$fixtures_path . \DIRECTORY_SEPARATOR . $ontology . \DIRECTORY_SEPARATOR . $path;
|
return self::$fixtures_path . \DIRECTORY_SEPARATOR . $ontology . \DIRECTORY_SEPARATOR . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setUpBeforeClass(): void
|
public function load(ObjectManager $manager)
|
||||||
{
|
|
||||||
static::bootKernel();
|
|
||||||
if (!static::$loaded_fixtures) {
|
|
||||||
static::loadFixtures();
|
|
||||||
}
|
|
||||||
static::$loaded_fixtures = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function loadFixtures(string $ontology = 'gnusocial'): void
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Beware that it's important to Load Actors, Objects, Activities in this sequence
|
* Beware that it's important to Load Actors, Objects, Activities in this sequence
|
||||||
* because we're running offline tests here.
|
* because we're running offline tests here.
|
||||||
*/
|
*/
|
||||||
|
$ontology = 'gnusocial';
|
||||||
|
|
||||||
// Load Actors
|
// Load Actors
|
||||||
$person = Actor::fromJson(file_get_contents(self::fixturesPath('objects/person.jsonld', $ontology)));
|
$person = Actor::fromJson(file_get_contents(self::fixturesPath('objects/person.jsonld', $ontology)));
|
Loading…
Reference in New Issue
Block a user