update
This commit is contained in:
@@ -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,
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user