Gruppen 1.3.0: Beiträge im Feed, Einladungen und Anfragen als Aufgaben
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
da90d764e3
commit
77ae23ce11
3 changed files with 82 additions and 1 deletions
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
namespace Tests\Plugins\Gruppen;
|
||||
|
||||
use App\Feed\Feed;
|
||||
use App\Models\User;
|
||||
use App\Notifications\PortalNotification;
|
||||
use App\Tasks\Tasks;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
|
@ -193,4 +195,28 @@ class GruppenTest extends TestCase
|
|||
$closedPost = Post::query()->where('group_id', $closed->id)->firstOrFail();
|
||||
$this->getJson("/api/v1/gruppen/beitraege/{$closedPost->id}")->assertNotFound();
|
||||
}
|
||||
|
||||
public function test_posts_reach_the_feed_and_invitations_and_requests_become_tasks(): void
|
||||
{
|
||||
if (! class_exists(Feed::class)) {
|
||||
$this->markTestSkipped('Inhaus ohne Feed');
|
||||
}
|
||||
|
||||
[$ada, $bob, $eve] = User::factory()->count(3)->create()->all();
|
||||
$group = $this->group($ada, 'closed');
|
||||
$this->actingAs($ada)->postJson("/gruppen/{$group->slug}/beitraege", ['body' => 'Mittwoch 17 Uhr am Haupteingang?'])->assertCreated();
|
||||
|
||||
$feed = collect(app(Feed::class)->page($ada)['items'])->firstWhere('kind', 'group-post');
|
||||
$this->assertSame('Mittwoch 17 Uhr am Haupteingang?', $feed['text']);
|
||||
$this->assertSame('Laufgruppe', $feed['context']['label']);
|
||||
// Nicht-Mitglieder sehen den Beitrag nicht
|
||||
$this->assertNull(collect(app(Feed::class)->page($eve)['items'])->firstWhere('kind', 'group-post'));
|
||||
|
||||
// Einladung → Aufgabe für Bob; Beitrittsanfrage von Eve → Aufgabe für Ada
|
||||
$this->actingAs($ada)->post("/gruppen/{$group->slug}/einladen", ['users' => [$bob->id]]);
|
||||
$this->actingAs($eve)->post("/gruppen/{$group->slug}/beitreten");
|
||||
|
||||
$this->assertContains('Einladung in „Laufgruppe“ annehmen', array_column(app(Tasks::class)->forUser($bob), 'title'));
|
||||
$this->assertContains('1 Beitrittsanfrage in „Laufgruppe“', array_column(app(Tasks::class)->forUser($ada), 'title'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue