This commit is contained in:
2026-03-20 21:17:26 +01:00
parent 1a62fcb81d
commit 29c3ff8572
229 changed files with 13147 additions and 2577 deletions

View File

@@ -1,5 +1,6 @@
<?php
use App\Models\ActivityEvent;
use App\Models\Story;
use App\Models\User;
use App\Notifications\StoryStatusNotification;
@@ -74,3 +75,21 @@ it('moderator can reject a pending story with reason and notify creator', functi
Notification::assertSentTo($creator, StoryStatusNotification::class);
});
it('admin approval records a story publish activity event', function () {
$admin = User::factory()->create(['role' => 'admin']);
$creator = User::factory()->create();
$story = createPendingReviewStory($creator);
$this->actingAs($admin)
->post(route('admin.stories.approve', ['story' => $story->id]))
->assertRedirect();
$this->assertDatabaseHas('activity_events', [
'actor_id' => $creator->id,
'type' => ActivityEvent::TYPE_UPLOAD,
'target_type' => ActivityEvent::TARGET_STORY,
'target_id' => $story->id,
]);
});