- Fix EventType deletion error handling (constraint violations) - Fix Event update error (package_id column missing) - Fix Event Type dropdown options (JSON display issue) - Fix EventPackagesRelationManager query error - Add missing translations for deletion errors - Apply Pint formatting
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Api;
|
|
|
|
use App\Mail\GiftVoucherIssued;
|
|
use App\Models\GiftVoucher;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Mail;
|
|
use Tests\TestCase;
|
|
|
|
class GiftVoucherResendTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_it_resends_voucher_emails(): void
|
|
{
|
|
Mail::fake();
|
|
config()->set('gift-vouchers.reminder_days', 0);
|
|
config()->set('gift-vouchers.expiry_reminder_days', 0);
|
|
|
|
$voucher = GiftVoucher::factory()->create([
|
|
'code' => 'GIFT-RESEND',
|
|
'purchaser_email' => 'buyer@example.com',
|
|
'recipient_email' => 'friend@example.com',
|
|
]);
|
|
|
|
$response = $this->postJson('/api/v1/marketing/gift-vouchers/resend', [
|
|
'code' => 'gift-resend',
|
|
]);
|
|
|
|
$response->assertOk();
|
|
Mail::assertQueued(GiftVoucherIssued::class, 2);
|
|
}
|
|
|
|
public function test_it_requires_code(): void
|
|
{
|
|
$response = $this->postJson('/api/v1/marketing/gift-vouchers/resend', []);
|
|
|
|
$response->assertStatus(422);
|
|
}
|
|
}
|