2017-09-11 16:08:58 +01:00
|
|
|
<?php
|
|
|
|
|
2021-03-17 18:38:18 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2017-09-11 16:08:58 +01:00
|
|
|
namespace Tests\Feature;
|
|
|
|
|
2021-03-17 18:38:18 +00:00
|
|
|
use App\Models\Note;
|
2017-09-11 16:08:58 +01:00
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class ActivityStreamTest extends TestCase
|
|
|
|
{
|
2021-03-17 18:38:18 +00:00
|
|
|
/** @test */
|
|
|
|
public function homepageRequestReturnsDataForSiteOwner(): void
|
2017-09-11 16:08:58 +01:00
|
|
|
{
|
|
|
|
$response = $this->get('/', ['Accept' => 'application/activity+json']);
|
|
|
|
$response->assertHeader('Content-Type', 'application/activity+json');
|
|
|
|
$response->assertJson([
|
|
|
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
|
|
|
'id' => config('app.url'),
|
|
|
|
'type' => 'Person',
|
2017-09-13 17:56:47 +01:00
|
|
|
'name' => config('user.displayname'),
|
2017-09-11 16:08:58 +01:00
|
|
|
]);
|
|
|
|
}
|
2017-09-13 15:49:37 +01:00
|
|
|
|
2021-03-17 18:38:18 +00:00
|
|
|
/** @test */
|
|
|
|
public function requestForNoteIncludesActivityStreamData(): void
|
2017-09-13 15:49:37 +01:00
|
|
|
{
|
2021-03-17 18:38:18 +00:00
|
|
|
$note = Note::find(11);
|
2017-09-13 15:49:37 +01:00
|
|
|
$response = $this->get('/notes/B', ['Accept' => 'application/activity+json']);
|
|
|
|
$response->assertHeader('Content-Type', 'application/activity+json');
|
|
|
|
$response->assertJson([
|
|
|
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
|
|
|
'type' => 'Add',
|
|
|
|
'actor' => [
|
|
|
|
'type' => 'Person',
|
|
|
|
'id' => config('app.url'),
|
|
|
|
],
|
|
|
|
'object' => [
|
|
|
|
'type' => 'Note',
|
|
|
|
'name' => strip_tags($note->note)
|
|
|
|
]
|
|
|
|
]);
|
|
|
|
}
|
2017-09-11 16:08:58 +01:00
|
|
|
}
|