[PLUGIN][ActivityPub][Tests] Create Actor Tests

This commit is contained in:
2022-03-13 15:54:48 +00:00
parent 636cb681d6
commit 390c532456
3 changed files with 101 additions and 2 deletions

View File

@@ -79,7 +79,10 @@ class Actor extends Model
* Create an Entity from an ActivityStreams 2.0 JSON string
* This will persist a new GSActor, ActivityPubRSA, and ActivityPubActor
*
* @throws Exception
* @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface
* @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface
* @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface
* @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface
*/
public static function fromJson(string|AbstractObject $json, array $options = []): ActivitypubActor
{
@@ -187,7 +190,7 @@ class Actor extends Model
} else {
// Delete existing avatar if any
try {
$avatar = DB::findOneBy('avatar', ['actor_id' => $actor->getId()]);
$avatar = DB::findOneBy(\Component\Avatar\Entity\Avatar::class, ['actor_id' => $actor->getId()]);
$avatar->delete();
Event::handle('AvatarUpdate', [$actor->getId()]);
} catch (Exception) {