Files
fotospiel-app/tests/Feature/Console/SendGuestFeedbackRemindersTest.php
2025-11-12 18:46:00 +01:00

36 lines
964 B
PHP

<?php
namespace Tests\Feature\Console;
use App\Models\Event;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class SendGuestFeedbackRemindersTest extends TestCase
{
use RefreshDatabase;
public function test_command_creates_feedback_notifications_for_past_events(): void
{
$event = Event::factory()->create([
'status' => 'published',
'is_active' => true,
'date' => now()->subDay(),
]);
$this->artisan('guest:feedback-reminders', ['--hours' => 0])
->assertExitCode(0);
$this->assertDatabaseHas('guest_notifications', [
'event_id' => $event->id,
'type' => 'feedback_request',
]);
// Running again should not duplicate notifications
$this->artisan('guest:feedback-reminders', ['--hours' => 0])
->assertExitCode(0);
$this->assertDatabaseCount('guest_notifications', 1);
}
}