feat: automate guest notification triggers
This commit is contained in:
35
tests/Feature/Console/SendGuestFeedbackRemindersTest.php
Normal file
35
tests/Feature/Console/SendGuestFeedbackRemindersTest.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user